--- a/SmallInteger.st Wed Jan 23 10:08:55 2013 +0000
+++ b/SmallInteger.st Mon Jan 28 21:53:19 2013 +0000
@@ -4020,6 +4020,40 @@
^ self < 0
!
+nextPowerOf2
+ "return the power of 2 at or above the receiver.
+ Useful for padding."
+
+%{ /* NOCONTEXT */
+ INT x;
+
+ x = __intVal(self) - 1;
+ x |= (x >> 1);
+ x |= (x >> 2);
+ x |= (x >> 4);
+ x |= (x >> 8);
+ x |= (x >> 16);
+#if __POINTER_SIZE__ == 8
+ x |= (x >> 32);
+#endif
+ RETURN (__MKINT(x + 1));
+%}
+ "
+ 1 nextPowerOf2
+ 2 nextPowerOf2
+ 3 nextPowerOf2
+ 4 nextPowerOf2
+ 5 nextPowerOf2
+ 6 nextPowerOf2
+ 7 nextPowerOf2
+ 8 nextPowerOf2
+
+ 22 nextPowerOf2
+ 10 factorial nextPowerOf2
+ 20 factorial nextPowerOf2
+ "
+!
+
odd
"return true, if the receiver is odd"
@@ -4123,9 +4157,9 @@
!SmallInteger class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.199 2013-01-08 17:55:11 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.200 2013-01-23 18:03:50 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.199 2013-01-08 17:55:11 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.200 2013-01-23 18:03:50 cg Exp $'
! !