View Single Post
Old Jul 13th, 2005, 5:56 AM   #18
M.Hirsch
Newbie
 
Join Date: Jun 2005
Posts: 26
Rep Power: 0 M.Hirsch is on a distinguished road
Quote:
Originally Posted by Scorpions4ever
Maybe make it a function instead of a macro? At least, that will avoid any fun side-effects with macros (for instance, y = BToL(x++) will cause very interesting issues).
Hmmm. Ok, you convinced me. I won't add more brackets or magic, I'll make a function of it If speed becomes an issue I can still switch to asm.

int btol(int x) {
  return ((x & 0xFF000000) >> 24) + ((x & 0xFF0000) >> 8) + ((x & 0xFF00) << 8) + ((x & 0xFF) << 24);
}
The function will be used to convert files of several 100MB, maybe even gigs...
Should I use a register here maybe? But then, I'll get the code done first, optimize later.

M.
__________________
Multilingual Content Management
M.Hirsch is offline   Reply With Quote