Ask a Question related to Mac Programming, Design and Development.

  1. #1

    Default Bit shifts in Cocoa

    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.

    -Korbin
    Korbin Meiser Guest

  2. Similar Questions and Discussions

    1. #39422 [NEW]: Time shifts randomly between GMT and PST
      From: daemonist at guildmail dot sojurn dot org Operating system: Windows 2003 Server PHP version: 4CVS-2006-11-08 (CVS) PHP Bug...
    2. Colour Shifts with CS
      Hello All, I'm having some big colour shifting issues with my Illustrator CS files. I have a logo that I am sending to various third party sources....
    3. Slicing shifts layout....?
      Hi, I've got a problem with slicing, for some reason I can slice 4/5 of my page. The bottom (1/5) I can't touch, when I do that, and preview I get...
    4. Cocoa Filemaker
      "Edward Smith" <esmith@thegoodstuff.se> wrote in message news:BB44ABA1.4676%esmith@thegoodstuff.se... I presume so. There was a statement from...
    5. Text shifts in Netscape
      What can I do to stop text from shifting within layers when the site is opened in Netscape?
  3. #2

    Default Re: Bit shifts in Cocoa

    On 10 Sep 2003, Korbin Meiser wrote:
    > 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.
    First of all, your question as asked doesn't make sense. Cocoa is not a
    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:mail@mikeash.com>

    Michael J Ash Guest

  4. #3

    Default Re: Bit shifts in Cocoa

    In article <be168cf0.0309101256.6792012d@posting.google.com >,
    [email]cryptofish@hotmail.com[/email] (Korbin Meiser) wrote:
    > 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.
    It would help if you told us what programming language you're using. :-T

    The languages that have Cocoa bindings that I know of include

    Objective C
    Java
    Python
    Perl
    AppleScript

    and there are probably just as many others. Some of them support
    bit-shifts, others don't. Objective C (which is the language you'll want
    to be using if you're doing anything as advanced as a bit-shift)
    supports the << and >> operators just fine.

    Cheers,
    -- M. Uli Kusterer
    [url]http://www.zathras.de[/url]
    Uli Kusterer Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139