WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.2% of users enabled 2FA.

Commit 9f2af92b authored by Stefan Marr's avatar Stefan Marr
Browse files

Added primitive for binary and and binary xor to Double



Binary operators on Double will convert the numbers first into a int/long.
Signed-off-by: default avatarStefan Marr <git@stefan-marr.de>
parent 54182a5d
......@@ -73,6 +73,24 @@ def _lessThan(ivkbl, frame, interpreter):
else:
frame.push(interpreter.get_universe().falseObject)
def _and(ivkbl, frame, interpreter):
op1 = _coerce_to_double(frame.pop(), interpreter.get_universe())
op2 = frame.pop()
left = int(op2.get_embedded_double())
right = int(op1.get_embedded_double())
result = float(left & right)
frame.push(interpreter.get_universe().new_double(result))
def _bitXor(ivkbl, frame, interpreter):
op1 = _coerce_to_double(frame.pop(), interpreter.get_universe())
op2 = frame.pop()
left = int(op2.get_embedded_double())
right = int(op1.get_embedded_double())
result = float(left ^ right)
frame.push(interpreter.get_universe().new_double(result))
def _round(ivkbl, frame, interpreter):
rcvr = frame.pop()
int_value = int(round_double(rcvr.get_embedded_double(), 0))
......@@ -91,3 +109,6 @@ class DoublePrimitives(Primitives):
self._install_instance_primitive(Primitive("%", self._universe, _mod))
self._install_instance_primitive(Primitive("=", self._universe, _equals))
self._install_instance_primitive(Primitive("<", self._universe, _lessThan))
self._install_instance_primitive(Primitive("&", self._universe, _and))
self._install_instance_primitive(Primitive("bitXor:", self._universe, _bitXor))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment