use uint32. Also, these three functions can probably be const.