equal
deleted
inserted
replaced
756 ^ BCDConversionErrorSignal |
756 ^ BCDConversionErrorSignal |
757 |
757 |
758 "Modified: / 15.11.1999 / 20:35:20 / cg" |
758 "Modified: / 15.11.1999 / 20:35:20 / cg" |
759 ! ! |
759 ! ! |
760 |
760 |
761 |
|
762 |
|
763 !Integer class methodsFor:'class initialization'! |
761 !Integer class methodsFor:'class initialization'! |
764 |
762 |
765 initialize |
763 initialize |
766 BCDConversionErrorSignal isNil ifTrue:[ |
764 BCDConversionErrorSignal isNil ifTrue:[ |
767 BCDConversionErrorSignal := ConversionError newSignal. |
765 BCDConversionErrorSignal := ConversionError newSignal. |
2332 16r12345678 digitBytesMSB:false |
2330 16r12345678 digitBytesMSB:false |
2333 " |
2331 " |
2334 ! |
2332 ! |
2335 |
2333 |
2336 swapBytes |
2334 swapBytes |
2337 ^ (LargeInteger digitBytes:(self digitBytes swapBytes)) compressed |
2335 "swap byte pair-wise in an integer |
|
2336 i.e. a.b.c.d -> b.a.d.c" |
|
2337 |
|
2338 |digitBytes| |
|
2339 |
|
2340 self negative ifTrue:[ |
|
2341 RangeError raiseWith:self errorString:'negative numbers are not supported in #swapBytes'. |
|
2342 ]. |
|
2343 digitBytes := self digitBytes. |
|
2344 digitBytes size odd ifTrue:[ |
|
2345 "ByteArray<<#swapBytes needs even number of bytes. |
|
2346 Add 0 to the most significant position (the end)" |
|
2347 digitBytes := digitBytes copyWith:0. |
|
2348 |
|
2349 ]. |
|
2350 ^ (LargeInteger digitBytes:digitBytes swapBytes) compressed |
2338 |
2351 |
2339 " |
2352 " |
2340 16rFFEE2211 swapBytes hexPrintString |
2353 16rFFEE2211 swapBytes hexPrintString |
|
2354 16rFFEEAA2211 swapBytes hexPrintString |
2341 16r2211 swapBytes hexPrintString |
2355 16r2211 swapBytes hexPrintString |
|
2356 16rFF3FFFFF swapBytes |
2342 self assert:(SmallInteger maxVal swapBytes swapBytes == SmallInteger maxVal) |
2357 self assert:(SmallInteger maxVal swapBytes swapBytes == SmallInteger maxVal) |
2343 " |
2358 " |
2344 ! ! |
2359 ! ! |
2345 |
2360 |
2346 !Integer methodsFor:'coercing & converting'! |
2361 !Integer methodsFor:'coercing & converting'! |
5064 ! ! |
5079 ! ! |
5065 |
5080 |
5066 !Integer class methodsFor:'documentation'! |
5081 !Integer class methodsFor:'documentation'! |
5067 |
5082 |
5068 version |
5083 version |
5069 ^ '$Header: /cvs/stx/stx/libbasic/Integer.st,v 1.303 2014-10-02 18:19:36 stefan Exp $' |
5084 ^ '$Header: /cvs/stx/stx/libbasic/Integer.st,v 1.304 2014-10-04 22:23:30 stefan Exp $' |
5070 ! |
5085 ! |
5071 |
5086 |
5072 version_CVS |
5087 version_CVS |
5073 ^ '$Header: /cvs/stx/stx/libbasic/Integer.st,v 1.303 2014-10-02 18:19:36 stefan Exp $' |
5088 ^ '$Header: /cvs/stx/stx/libbasic/Integer.st,v 1.304 2014-10-04 22:23:30 stefan Exp $' |
5074 ! ! |
5089 ! ! |
5075 |
5090 |
5076 |
5091 |
5077 Integer initialize! |
5092 Integer initialize! |