Go to Post I think your robot is lacking in non-threatening, huggable design. - Kevin Sevcik [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 25-10-2008, 01:22
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
numeric AND

I've seen the AND function used with numeric datatypes, and I really don't understand:
What the heck does it mean like that? Does it convert the integers into boolean arrays, perform the function as if on an array, and then convert them back?

Thanks!
__________________
-- Marshal Horn
  #2   Spotlight this post!  
Unread 25-10-2008, 01:27
Vikesrock's Avatar
Vikesrock Vikesrock is offline
Team 2175 Founder
AKA: Kevin O'Connor
no team
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2007
Location: Manchester, NH
Posts: 3,305
Vikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond repute
Send a message via AIM to Vikesrock Send a message via MSN to Vikesrock Send a message via Yahoo to Vikesrock
Re: numeric AND

Quote:
Originally Posted by kamocat View Post
I've seen the AND function used with numeric datatypes, and I really don't understand:
What the heck does it mean like that? Does it convert the integers into boolean arrays, perform the function as if on an array, and then convert them back?

Thanks!
I believe you have the right idea.

All processors store numbers as groups of bits. Performing an AND on numeric datatypes performs the AND operation on these sets of bits. The way the processor sees it no conversion is necessary, the data is already right there in the correct format to do a logical AND bit by bit.

This is often useful to grab parts of a number, usually the most or least significant bits.
__________________


2007 Wisconsin Regional Highest Rookie Seed & Regional Finalists (Thanks 930 & 2039)
2008 MN Regional Semifinalists (Thanks 2472 & 1756)
2009 Northstar Regional Semifinalists (Thanks 171 & 525)

Last edited by Vikesrock : 25-10-2008 at 01:34.
  #3   Spotlight this post!  
Unread 25-10-2008, 01:37
Mr. Lim Mr. Lim is offline
Registered User
AKA: Mr. Lim
no team
Team Role: Leadership
 
Join Date: Jan 2004
Rookie Year: 1998
Location: Toronto, Ontario
Posts: 1,125
Mr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond repute
Re: numeric AND

Be careful about which AND you're talking about though, because there are two distinct types of AND.

Logical AND - "&&": This is the boolean type of AND that you're probably used to seeing. It can be used with numeric types as inputs, but generally translates numeric zeros to FALSE, and non-zero values to TRUE. It will generally output 0 for false, and 1 for true.

Bitwise AND - "&": This will take two numeric inputs, then perform a logical and for each bit in both inputs. For instance if you took two 8-bit binary numbers 11111111 & 00001111 = 00001111. Bitwise ANDs are commonly used for "bitmasking," which is when you only want to take few bits from a number and strip the rest away (make them 0).
__________________
In life, what you give, you keep. What you fail to give, you lose forever...
  #4   Spotlight this post!  
Unread 25-10-2008, 11:10
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: numeric AND

Ah, okay. That would also explain why they're using hexadecimal on one side. Thank you!
__________________
-- Marshal Horn
  #5   Spotlight this post!  
Unread 27-10-2008, 14:48
Russ Beavis Russ Beavis is offline
Registered User
no team
 
Join Date: Nov 2005
Location: Manchester, NH - DEKA R&D Corp.
Posts: 341
Russ Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond repute
Re: numeric AND

In all my years of LabVIEW experience, I don't think that I've ever tried to AND a pair of integers but I just tried it and d*&n if LabVIEW and polymorphism don't just work hand-in-hand. I typically use byte-to-boolean array (or similar) for bitwise manipulations of integers but I'm definitely going to exploit fixed point boolean "arithmetic" more often.

Thanks!
Russ
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bill of Materials, do it and do it well, and bring it to your event sanddrag Rules/Strategy 3 24-03-2006 21:09
Thank you 1359 and 1569 and Congrats 492, 1595, 604 SilverStar Thanks and/or Congrats 0 13-03-2005 23:21
pic: Stars and Stripes over Einstein and Galileo CD47-Bot Extra Discussion 6 01-05-2004 00:54


All times are GMT -5. The time now is 01:19.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi