Closed TethysSvensson closed 8 years ago
Should we expose (and use) p32u
in lieu of standard usage of p32
, and then have p32
be the 'dont care' version? These are already in the module as _p32u
and _p32s
, they are just not exposed.
I think I would be okay with that. The current behavior is not particularly nice.
I still think we should have four versions. For p8, those would be:
[0, 255]
(unsigned)[-128, 127]
(signed)[-128, 255]
(lenient, but still validating that you are not an idiot)I think I would prefer that the default version is number 3, but I would like to have all three as a possibility. In particular I would probably use the accept everything version sometimes when dealing with stuff that should wrap around, but normally I like the sanity checking that the number is in fact small enough.
So the behavior effectively becomes:
If sign is None and number is negative, set sign to "True"
?
Zach Riggle
On Jan 10, 2015, at 3:32 AM, Mathias Svensson notifications@github.com wrote:
I think I would be okay with that. The current behavior is not particularly nice.
I still think we should have four versions. For p8, those would be:
Only accept 0, 255 Only accept -128, 127 Only accept -128, 255 Accept everything I think I would prefer that the default version is number 3, but I would like to have all three as a possibility. In particular I would probably use the accept everything version sometimes when dealing with stuff that should wrap around, but normally I like the sanity checking that the number is in fact small enough.
— Reply to this email directly or view it on GitHub.
We should continue to have the mode "unsigned" and "signed" as we currently have, which will reject anything outside [-2^(n-1), 2^(n-1)-1] and [0, 2^n-1] respectively. They are currently represented as True and False.
We should also have a mode that accepts the combined range [-2^(n-1), 2^n-1] and another that just does not care and will and it into the bytes not matter how big/small a number.
This is important as we need it for e.g. push and move shellcodes to work in a sane manner (more specifically we need the combined range version).