Hello, I am working on a project in which I have multiple 16x128x16 chunks of data(basically just a 3d array). I need to save the chunks so that they can be easily and quickly rebuilt later. The problem is that each element in the chunk is a short, so each chunk uses a lot of space. Would there be some algorithm that I could use to add all the values in the chunk together, then generate a key to rebuild the chunk based on the values added to it? If not, what is some other efficient approach that I could take?

Edited by Afropuff01

5 Years
Discussion Span
Last Post by Momerath

It takes 8 bits to store a short, no matter how you decide to store it. So unless you have some way to compress the data you aren't going to be saving any space.

Does the data have large groupings of the same value?


What is the maximum value you are putting into these shorts? Are they signed? If you are not filling the shorts right up, and they aren't signed, then maybe you can get away with packing them all into maybe 12 bits rather than 16 (a short is 2 bytes (16 bits not 8 bits as said above)).


You are correct, comes from dealing with multiple programming languages where everyone has their own definition of 'short' :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.