Integer.st
branchjv
changeset 18117 eb433f2c42b2
parent 18112 0d7ac9096619
parent 15911 0dfd943efdf5
child 18120 e3a375d5f6a8
equal deleted inserted replaced
18116:bf7f37b63ea2 18117:eb433f2c42b2
  2292         -12345678 byteAt:2
  2292         -12345678 byteAt:2
  2293         -12345678 digitBytes at:2
  2293         -12345678 digitBytes at:2
  2294     "
  2294     "
  2295 !
  2295 !
  2296 
  2296 
  2297 byteSwapped
       
  2298     "lsb -> msb;
       
  2299      i.e. a.b.c.d -> d.c.b.a"
       
  2300 
       
  2301     ^ LargeInteger digitBytes:(self digitBytes) MSB:true
       
  2302 
       
  2303     "Created: / 31-01-2012 / 12:17:57 / cg"
       
  2304 !
       
  2305 
       
  2306 digitByteLength
  2297 digitByteLength
  2307     "return the number bytes required for a 2's complement
  2298     "return the number bytes required for a 2's complement
  2308      binary representation of this Integer.
  2299      binary representation of this Integer.
  2309      For positive receivers, thats the same as the digitLength."
  2300      For positive receivers, thats the same as the digitLength."
  2310 
  2301 
  4996 
  4987 
  4997     "fast (using moduloNumber with almost same-sized dividend and divisor):
  4988     "fast (using moduloNumber with almost same-sized dividend and divisor):
  4998      |m|
  4989      |m|
  4999 
  4990 
  5000      m := self new modulus:123456789901398721398721931729371293712943794254034548369328469438562948623498659238469234659823469823658423659823658.
  4991      m := self new modulus:123456789901398721398721931729371293712943794254034548369328469438562948623498659238469234659823469823658423659823658.
  5001      Time millisecondsToRun:[
  4992     m modulusOf:874928459437598375937451931729371293712943794254034548369328469438562948623498659238469234659823469823658423659823658.
  5002         100000 timesRepeat:[
  4993 10730930127807326146398409623772237722337234475792709784029183368622308259008044569184592041059181058049458041058052     ]
  5003             m modulusOf:874928459437598375937451931729371293712943794254034548369328469438562948623498659238469234659823469823658423659823658.
       
  5004         ]
       
  5005      ]
       
  5006     "
  4994     "
  5007 
  4995 
  5008     "Modified: / 3.5.1999 / 14:30:32 / stefan"
  4996     "Modified: / 3.5.1999 / 14:30:32 / stefan"
  5009 ! !
  4997 ! !
  5010 
  4998 
  5018 ! !
  5006 ! !
  5019 
  5007 
  5020 !Integer class methodsFor:'documentation'!
  5008 !Integer class methodsFor:'documentation'!
  5021 
  5009 
  5022 version
  5010 version
  5023     ^ '$Header: /cvs/stx/stx/libbasic/Integer.st,v 1.288 2013-12-02 20:00:24 stefan Exp $'
  5011     ^ '$Header: /cvs/stx/stx/libbasic/Integer.st,v 1.290 2014-01-25 21:35:22 cg Exp $'
  5024 !
  5012 !
  5025 
  5013 
  5026 version_CVS
  5014 version_CVS
  5027     ^ '$Header: /cvs/stx/stx/libbasic/Integer.st,v 1.288 2013-12-02 20:00:24 stefan Exp $'
  5015     ^ '$Header: /cvs/stx/stx/libbasic/Integer.st,v 1.290 2014-01-25 21:35:22 cg Exp $'
  5028 ! !
  5016 ! !
  5029 
  5017 
  5030 
  5018 
  5031 Integer initialize!
  5019 Integer initialize!