Bond697

GameFreak Sucks

Aug 16th, 2011
553
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. Where possible, it is best to avoid using char and short as local variables. For the types
  2. char and short the compiler needs to reduce the size of the local variable to 8 or 16 bits
  3. after each assignment. This is called sign-extending for signed variables and zero-
  4. extending for unsigned variables. It is implemented by shifting the register left by 24 or 16
  5. bits, followed by a signed or unsigned shift right by the same amount, taking two
  6. instructions (zero-extension of an unsigned char takes one instruction).
  7.  
  8. These shifts can be avoided by using int and unsigned int for local variables. This
  9. is particularly important for calculations which first load data into local variables and then
  10. process the data inside the local variables. Even if data is input and output as 8- or 16-bit
  11. quantities, it is worth considering processing them as 32-bit quantities.
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment