Reputation: 180
I have a case class with a List[Long] attribute that I am converting into a token using the Scodec library. Right now, it is not efficient (space-wise) because I am using this codec:
listOfN(uint16, int64)
This is using all 64 bits even though my Longs are never more than a few thousand (as of now). Is there a built-in way in Scodec library to use only as many bits as absolutely needed?
Thanks
Upvotes: 2
Views: 155
Reputation: 3855
If your long values are non-negative, try using the vpbcd
codec:
listOfN(uint16, vpbcd)
This encodes using variable length packed binary-coded decimal format.
Upvotes: 2