Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smallest possible size #18

Open
kengruven opened this issue May 8, 2021 · 1 comment
Open

Smallest possible size #18

kengruven opened this issue May 8, 2021 · 1 comment

Comments

@kengruven
Copy link

The CBE spec says:

"Preservation of the original numeric data type information is not considered important by default. Encoders SHOULD [i.e., but are not required to] use the smallest encoding that stores a value without data loss."

It looks like enctool is not yet clever enough to pick the smallest numeric type for a given value. It just looks at the CTE notation to decide which CBE encoding to use. Sometimes it actually picks the biggest one:

$ echo 'c1 32768.0' | ../enctool/enctool convert -df cbe|hexdump
0000000 03 00 65 00 80 80 02                           
0000007
$ echo 'c1 0x8000.0' | ../enctool/enctool convert -df cbe|hexdump
0000000 03 00 70 00 47                                 
0000005
$ echo 'c1 32768' | ../enctool/enctool convert -df cbe|hexdump
0000000 03 00 6a 00 80                                 
0000005
@kstenerud
Copy link
Owner

Yup, the current reference implementation doesn't try very hard yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants