libBERT icon indicating copy to clipboard operation
libBERT copied to clipboard

Change BERT_MAX_INT and BERT_MIN_INT

Open sc0Vu opened this issue 5 years ago • 2 comments

Issue: #6

The int should be 4 bytes ((232) - 1) and (-(232)) which means ((1 << 31) - 1) and (-(1<<31))

Change:

  • BERT_MAX_INT ((1 << 31) - 1)
  • BERT_MIN_INT (-(1 << 31))

sc0Vu avatar Jun 23 '19 15:06 sc0Vu

It's been a while since I worked on this library, but the MAX_INT/MIN_INT values come from other BERT libraries: https://github.com/mojombo/bert/blob/c2abcc4868bb47909696c6a42c606de34e83ef70/lib/bert/types.rb#L18-L19

I can't find where they are exactly defined in the Erlang External Term Format specification.

postmodern avatar Mar 16 '21 07:03 postmodern

Thanks for your reply. It's been a while, and we switch to another encoding.

By the way, I found documentation about integer size on erlang website: http://erlang.org/doc/apps/erts/erl_ext_dist.html#integer_ext.

Hope this helps.

sc0Vu avatar Mar 17 '21 06:03 sc0Vu