Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

#14 (calculating 2^n), is usually implemented as:

  return 1 << n;

in which case it would also work for n == 0. The method shown in the article has a comment requiring n > 0.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: