Towards support full range of small ints in bytecode #311
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So, one issue we have is:
Encoding of int's apparently should be consistent with encoding of uint's. Then this patch tries to support encoding arbitrary uint's (and regardless of its bitsize). Let me know if you like and I clean it up (tests pass with it).
Then beyond uint's, varlen encoding for ints has its peculiarities. Note that I don't think that static biasing like you emit_write_byte_code_byte_int() with num += 0x800000 helps here. It turns "short" 0 in a big long value for example (I guess that's why you didn't make it varlen encoded, just static 3-byte). Obvious way to overcome that is to use "sign + magnitude" encoding (like floats), but that requires extra magic to handle MIN_INT, so I'd hope that some smart sign management allow to store two's complement still...