Xblog.org

>> Home


Locations of visitors to this page

29 November 2007

The subtle art of code conversion.

Well last night I spent a little time working on the MAP file loader for the Asset Manager program, and I have this to say about Paul’s code, YOU’RE A GIT!! Who in their right mind writes their own “getword” method that swaps the bytes around?

Most normal people would use something like:-
Return = (short)(getc(file) << 8) + getc(file)
NOT:-
Value1 = getc(file);
Value2 = getc(file);
Return (short)(Value1 + (Value2 << 8)
WHAT WERE YOU THINKING!!!

Added to that is the fact that the LRE compression for the file is just a little odd rather than keeping the whole logic in the one method it’s spread over three methods with a global short for the value you just got, but I think I’ve got most of it sorted.

Labels: , , ,

posted by Dave Henry at  

0 Comments:

Post a Comment

Links to this post:

Create a Link