Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

less than 1 byte data type

  Asked By: Cory    Date: Mar 02    Category: MS Office    Views: 957
  

I have a really huge array a(10000000, 100) (defined as byte right
now) for a combinatorial problem almost hitting RAM memory (1.2 GB).
One has to either spend large computational time or need large RAM
memory in these problems.

Each entry of the array can only take a value between 1 to 8. Is
there a data type less than one byte

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Amanda Carter     Answered On: Mar 02

Here's an idea from an old C programmer, so maybe it will work here also.
Pack the values 1-8 into a larger structure, say char of large length
(say 334000 in your case).
1-8 can be revalued as 0-7, which is 0-111 in binary.
Use software to pack/unpack as desired.
I don't know if VBA has capability to handle bit-fiddling, so maybe this
is all ca-ca.
Also, you can set up a structure using 3-bit elements (again, maybe VBA
will nix this).
At the least, you could cut your RAM net to 500,000 bytes by packing 2
values per char.
Thus, the values 5 and 6 could be packed into a char as 00101110, or 2E hex.

 
Didn't find what you were looking for? Find more on less than 1 byte data type Or get search suggestion and latest updates.




Tagged: