Results 1 to 4 of 4

Thread: opcode's

Hybrid View

  1. #1
    Frenzied Member ae_jester's Avatar
    Join Date
    Jun 01
    Location
    Kitchener Ontario Canada Earth
    Posts
    1,545

    opcode's

    Hi,

    I was told that there is an intel opcode that can be used to get the first bit set of an integer. I've searched all over and can't find anything, let alone some good documentation on this stuff.

    Does anyone know what it is, and how I would go about using this?

    If not, is there any other fast way to get the first set bit of an int without looping through each bit?

    Thanks!

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 00
    Location
    0x002F2EA8
    Posts
    7,221
    bsf is the forward bitscan operator and bsr reverse
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Frenzied Member ae_jester's Avatar
    Join Date
    Jun 01
    Location
    Kitchener Ontario Canada Earth
    Posts
    1,545
    How would I use that, could you please provide an example? Thanks!

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 00
    Location
    0x002F2EA8
    Posts
    7,221
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

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