ceil(x/2)
operation where x
is an integer. A very short, branch-free way occured to me how to code this operation. The following code assumes x
in %eax
and finishes with the desired result in %eax
shrl $1, %eax
adc $0, %eax
TAOCP assembler knuth
No comments:
Post a Comment