On 10 Sep 2003, Korbin Meiser wrote:

First of all, your question as asked doesn't make sense. Cocoa is not a> Does anyone know how to do bit shifts in Cocoa? I have declared an

> integer and I want to shift it one bit to the right (same as dividing

> by 2). How can this be done in Cocoa? I already tried "x >> 1", but

> it did not recognize the ">>" syntax. I'm also interested in

> information about other mathematical logical syntax in Cocoa. I

> didn't find anything about that on the apple developer web site. Any

> help is appreciated.

programming langauge, it is an API. You probably meant Objective-C, which

is the langauge normally used with Cocoa.

Objective-C is just C with some OO stuck on. So all the basic math

operators are the same. Your "x >> 1" statement should work. If it

doesn't, it's either because you have another error, or you're not using

Objective-C.

--

"From now on, we live in a world where man has walked on the moon.

And it's not a miracle, we just decided to go." -- Jim Lovell

Mike Ash - <http://www.mikeash.com/>, <mailto:mailmikeash.com>

## Bookmarks