nga-python: n:MIN and n:MAX queries now reporting a 128-bit range (#30) along with some comments regarding this
FossilOrigin-Name: 1998a44c226313a0e86b635f10fb6fb06ed6698fd62a75e81f1a6a22883ae125
This commit is contained in:
parent
f05a03d167
commit
84f5134687
1 changed files with 18 additions and 3 deletions
|
@ -253,6 +253,22 @@ class Retro:
|
|||
else:
|
||||
self.stack.push(0)
|
||||
|
||||
# The fetch instruction also handles certain
|
||||
# introspection queries.
|
||||
#
|
||||
# Of note is the min and max values for a cell.
|
||||
# In most VM implementations, this is limited
|
||||
# to 32 bit or 64 bit ranges, but Python allows
|
||||
# an unlimited range.
|
||||
#
|
||||
# I report as if the cells are capped at 128 bits
|
||||
# but you can safely ignore this if running on
|
||||
# the Python VM. (This does have an impact on
|
||||
# floating point values, if using the `e:` words
|
||||
# for converting them to/from an encoded format in
|
||||
# standard cells, but should not affect anything
|
||||
# else in the standard system)
|
||||
|
||||
def i_fetch(self):
|
||||
target = self.stack.pop()
|
||||
if target >= 0:
|
||||
|
@ -266,13 +282,12 @@ class Retro:
|
|||
elif target == -3:
|
||||
self.stack.push(self.memory.size())
|
||||
elif target == -4:
|
||||
self.stack.push(2147483648)
|
||||
self.stack.push(-170141183460469231731687303715884105728)
|
||||
elif target == -5:
|
||||
self.stack.push(2147483647)
|
||||
self.stack.push(170141183460469231731687303715884105727)
|
||||
else:
|
||||
self.stack.push(0)
|
||||
|
||||
|
||||
def i_store(self):
|
||||
mi = self.stack.pop()
|
||||
self.memory[mi] = self.stack.pop()
|
||||
|
|
Loading…
Reference in a new issue