Integer.st
changeset 22069 1898747d4358
parent 21993 73aa16ebc889
child 22070 9ff5b5333e3e
--- a/Integer.st	Fri Jul 21 00:54:38 2017 +0200
+++ b/Integer.st	Fri Jul 21 14:46:26 2017 +0200
@@ -5128,6 +5128,26 @@
     ^ self
 !
 
+asUnsigned128
+    "return a 128-bit integer with my bit-pattern, but positive.
+     May be required for bit operations on the sign-bit and/or to
+     convert C numbers."
+
+    self < 0 ifTrue:[
+        ^ 16r1000000000000000000000000000000000 + self
+    ].
+    ^ self
+
+    "
+     (-1 asUnsigned128) hexPrintString
+     1 asUnsigned128
+     (SmallInteger minVal asUnsigned128) hexPrintString
+     (SmallInteger maxVal asUnsigned128) hexPrintString
+    "
+
+    "Created: / 21-07-2017 / 14:44:19 / cg"
+!
+
 asUnsigned32
     "return a 32-bit integer with my bit-pattern, but positive.
      May be required for bit operations on the sign-bit and/or to