int isTwoPower(int n){
if( n < 1 )
return 0;
return !(n & (n-1));
}
Sunday, November 30, 2008
isTwoPower
Very simple and elegant function to test if a number is a power of two.
Saturday, November 29, 2008
Hello World!
.data
hello:
.ascii "Hello World!\n"
len = . - hello
.text
.global _start
_start:
movl $4, %eax
movl $1, %ebx
movl $hello, %ecx
movl $len, %edx
int $0x80
movl $1, %eax
movl $0, %ebx
int $0x80
Subscribe to:
Posts (Atom)