Skip to content

Towards support full range of small ints in bytecode #311

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

Closed
wants to merge 1 commit into from

Conversation

pfalcon
Copy link
Contributor

@pfalcon pfalcon commented Feb 18, 2014

So, one issue we have is:

>>> 10000000
micropython: ../py/emitbc.c:146: emit_write_byte_code_byte_int: Assertion `0 <= num && num <= 0xffffff' failed.
Aborted

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...

WIP, for early review of approach. Do not merge.
@pfalcon
Copy link
Contributor Author

pfalcon commented Feb 19, 2014

Superseded by #312.

@pfalcon pfalcon closed this Feb 19, 2014
@pfalcon pfalcon deleted the bc-uint-varlen branch February 22, 2014 21:32
tannewt added a commit to tannewt/circuitpython that referenced this pull request Oct 14, 2017
* atmel-samd: Add support for internal filesystems.

This allows us to re-enable `os`. `random` is also enabled because
it solely depends on `os`.

Fixes micropython#266. Its also a pre-requisite for micropython#260.

* atmel-samd: Update SAMD51 linker script comments and MICROPY_MAX_STACK_USAGE enabling.
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

Successfully merging this pull request may close these issues.

1 participant