--- a/SmallInteger.st Sat Feb 11 22:04:14 2012 +0000
+++ b/SmallInteger.st Mon Feb 13 19:19:41 2012 +0000
@@ -691,7 +691,7 @@
(aNumber = 0) ifTrue:[
^ ZeroDivide raiseRequestWith:thisContext.
].
- ^ aNumber moduluFromInteger:self
+ ^ aNumber moduloFromInteger:self
"
9 \\ 4 == 1 ifFalse:[self halt].
@@ -703,7 +703,7 @@
1000 \\ 3600000 == 1000 ifFalse:[self halt]
"
- "Modified: / 09-08-2010 / 19:52:02 / cg"
+ "Modified: / 12-02-2012 / 20:43:40 / cg"
!
abs
@@ -1735,6 +1735,48 @@
!SmallInteger methodsFor:'byte access'!
+byteSwapped
+ "lsb -> msb;
+ i.e. a.b.c.d -> d.c.b.a"
+
+%{ /* NOCONTEXT */
+
+#if __POINTER_SIZE__ == 4
+ unsigned int v = __intVal(self);
+ unsigned int swapped;
+
+# ifdef __BORLANDC__
+# ifdef USE_BSWAP
+ _asm {
+ mov eax, v
+ bswap eax
+ mov swapped, eax
+ };
+# else
+ _asm {
+ mov eax, v
+ xchg al, ah
+ rol eax, 16
+ xchg al, ah
+ mov swapped, eax
+ };
+# endif
+# else
+ swapped = ((v>>24) | ((v>>8)&0xFF00) | ((v & 0xFF00)<<8) | ((v & 0xFF)<<24));
+# endif
+ RETURN (__MKUINT(swapped));
+#endif /* __POINTER_SIZE__ */
+%}.
+ ^ super byteSwapped
+
+ "
+ 16r11223344 byteSwapped hexPrintString
+ 16r44332211 byteSwapped hexPrintString
+ "
+
+ "Created: / 09-01-2012 / 23:01:33 / cg"
+!
+
digitAt:index
"return 8 bits of value, starting at byte index"
@@ -4048,16 +4090,17 @@
!SmallInteger class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.193 2012/01/09 19:37:51 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.195 2012/02/12 19:57:49 cg Exp $'
!
version_CVS
- ^ 'Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.193 2012/01/09 19:37:51 cg Exp '
+ ^ 'Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.195 2012/02/12 19:57:49 cg Exp '
!
version_SVN
- ^ '$Id: SmallInteger.st 10761 2012-01-19 11:46:00Z vranyj1 $'
+ ^ '$Id: SmallInteger.st 10777 2012-02-13 19:19:41Z vranyj1 $'
! !
+