Created
March 22, 2013 05:40
-
-
Save mythagel/5219207 to your computer and use it in GitHub Desktop.
bittest.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstdint> | |
#include <cstring> | |
int main() | |
{ | |
uint64_t hi; | |
uint64_t lo; | |
if(hi & 0x8000000000000000ULL) | |
hi = ~hi; | |
int off = ffsll(hi); | |
hi <<= off; | |
hi = ~hi; | |
int pattern = ffsll(hi); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment