Latest Articles (View All)

Swap two variables using XOR

Posted 01.16.2007, under Programming

Most people would swap two variables x and y using a temporary variable, like this:

tmp = x
x = y
y = tmp

Here’s a neat programming trick to swap two values without needing a temp:

x = x xor y
y = x xor y
x = x xor y

Don’t believe me? Try it out - write in any initial value for x and y:…

Unicode and You

Posted 12.28.2006, under Programming

A little diddy about binary file formats

Posted 12.28.2006, under Programming

Understanding Big and Little Endian Byte Order

Posted 09.19.2006, under Programming

Crowd Favorites

Math & Numbers

  • Mental math shortcuts, adding 1-100
  • Understanding exponents and the natural log
  • Div, Curl, Flux, Gradient and other Vector Calculus topics

Programming & Web Development

  • Site speedups with HTTP caching, gzip compression
  • Understanding Rails, Web debugging, and Javascrtipt
  • Swap bytes with XOR, byte order, unicode

Business, Writing & Communication



Like it? Try All articles, RSS Feed or Email Subscription | Idea or suggestion? Contact me
copyright © 2007 Kalid Azad