2

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

Neel Kumar
  • 180
  • 1
  • 9

1 Answers1

2

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.

mpilquist
  • 3,855
  • 21
  • 22