Title: Theory / Unimportant / CS / Algo / Hacker's delight{ / 06 Searching words
Tags: effectToImplementation fromAlgorithm hasNotNewEffectReturnsMeaning instructionToImplementation récupéré

Definition: The first \(i\) such that the \(i\)-th 8-bit word on the right is 00. Or 4 if there is no such \(i\)
Page: 91
Chapter: 6
Section: 1
Variables: \(x\) a 32-bit variable
Notation: zbyter(x)

Page: 91, 92
Variables: \(x\) a 32-bit variable
Expression: unsigned y;
int n;
y=(x&0x7F7F7F7F)+0x7F7F7F7F
y=~(y|x|0x7F7F7F7F)
n=nlz(y)>>3
return n
Chapter: 6
Section: 1
Binary: The first i such that the i-th 8-bit word on the left is 00 (base16). Or 4 if there is no such i
Notation: zbytel(x)
Expression2: if(x>>24==0) return 0
if(x&00FF0000==0) return 1
if(x&0000FF00==0) return 2
if(x&000000FF==0) return 3
Kind: , Feg,
Index: , 1, 2

Page: 92
Implementation: \(((x\&0111 1111 0111 1111 0111 1111 0111 1111)+0111 1111 0111 1111 0111 1111 0111 1111)|x \)
Section: 1
Chapter: 6
Effect: For each 8-bit word, it is 00000000 iff the word in the same position begins by a 0
Variables: \(x\) a 32-bit variable
Index: 2
Kind: Fig,

Page: 92
Section: 1
Notation: For each 8-bit word, it is 00000000 iff the word in the same position is 01111111
Variables: \(x\) a 32-bit variable
Chapter: 6
Example: \(\big((x\&01111111011111110111111101111111)+01111111011111110111111101111111\big)|x|01111111011111110111111101111111\)
Kind: Fig,
Index: 2