Notes on computers, programming and all the stuff
Pokazywanie postów oznaczonych etykietą
branchless
.
Pokaż wszystkie posty
Pokazywanie postów oznaczonych etykietą
branchless
.
Pokaż wszystkie posty
niedziela, 9 maja 2010
Branchless set mask if value greater or how to print hex values
›
Suppose we need to get mask when nonnegative argument is greater then some constant value; in other words, we want to evaluate following exp...
niedziela, 11 kwietnia 2010
Determining if an integer is a power of 2
›
Method from Bit Twiddling Hacks : (x != 0) && (x & (x-1) == 0) . GCC compiles this to following code: ; input/ouput: eax ; dest...
2 komentarze:
czwartek, 8 kwietnia 2010
Brenchless conditional exchange
›
Suppose we have to exchange (or just move) two registers A and B: C := A xor B C := 0 if condition is not true A := A xor C B := B xor...
czwartek, 1 kwietnia 2010
Branchless signum
›
Problem: calculate value of sign(x) : -1 when x < 0 0 when x = 0, +1 when x > 0. My solution do not involve any hardware specifi...
Fill word with selected bit
›
This is continuation of subproblem from previous post: we have a word (byte, dword, whatever) and want to fill it with selected bit. 1. Th...
›
Strona główna
Wyświetl wersję na komputer