View Single Post
  #1  
Old 10-10-2008, 07:16 PM
Rocker8956
Hill Giant
 
Join Date: Sep 2007
Posts: 117
Default Trimming variable fat

This is probably an amateur coder question but I am an amateur coder so…
I was looking through some of my recent code submissions and noticed I use int in places uint8 or uint16 would suffice. Would it be worth going through the code and trimming the fat on some of the variables?

Also, does a uint8 process faster and use less memory than a uint16?

Here is my list of variables I think could be trimmed (if you can think of more please let me know)

Code:
Reference	Type		Min	Max
Level 		uint8 		0 	255
ZoneID 		uint16 		0  	65535
charID 		uint16 		0 	65535 
accountID 	uint16 	 	0 	65535 
spawnID 	uint32 		0 	4294967295
Regarding accountID and charID, I doubt a server should ever reach 65535 accounts/characters in its database. Am I wrong?

I am willing to look through the code and make the changes. Just want to be certain I am not wasting my time or messing something up.
Reply With Quote