Search code examples
performanceintegerstoragememory-efficient

Why can a short only hold 65,536 possible values?


I understand that with a short you can have 65,536 possible ints, but why can't you have 255,256 possible values (0 to 255,255 unsigned)? I see that you could do it like this:

2 byte integer

Has someone already thought of this? Why isn't it used?


Solution

  • That wouldn't work.
    How would you store 254,300?