Bitwise & operator question

Quote:

>Well, that's an interesting and correct solution (provided x is unsigned)

>but it does not answer the poster's original question.

>Instead, he might consider the following backhanded clue:

<snip>

Quote:

>If we couple this behavior with the way that modulus and division are

>related we might think about bit patterns and find an answer.? Or not.

That is an absolutely correct observation, but a little bit of

boolean algebra will show you that it is not possible to implement

bit-shift (eg division by a power of two) without using at least one

other operator.

For reference's sake, any* operation that deals with integers can

be coded using only the operations NOT and AND, and therefore by

DeMorgan's Theorem, NOT and OR. This is a provable fact.

* When I say "any", I say "any" because I can't be bothered to think

? of a proper defintion which really means something between

? "pretty much any" and "anything you'd want to do".

Cheers,

Wes

--

PageMail, Inc.??????????????????? |

Kingston, ON Canada?????????????? | Voice: (888) 247 6246