[squeak-dev] The Trunk: Kernel-ul.485.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Aug 23 13:00:21 UTC 2010


Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ul.485.mcz

==================== Summary ====================

Name: Kernel-ul.485
Author: ul
Time: 23 August 2010, 2:13:52.357 pm
UUID: fce08992-f821-ed46-a863-9935d6a7fe2e
Ancestors: Kernel-dtl.484

- fix LargeInteger printing

=============== Diff against Kernel-dtl.484 ===============

Item was changed:
  ----- Method: LargePositiveInteger>>printOn:base:nDigits: (in category 'printing') -----
  printOn: aStream base: b nDigits: n
  	"Append a representation of this number in base b on aStream using n digits.
  	In order to reduce cost of LargePositiveInteger ops, split the number of digts approximatily in two
  	Should be invoked with: 0 <= self < (b raisedToInteger: n)"
  	
  	| halfPower half head tail |
  	n <= 1 ifTrue: [
  		n <= 0 ifTrue: [self error: 'Number of digits n should be > 0'].
  		
  		"Note: this is to stop an infinite loop if one ever attempts to print with a huge base
  		This can happen because choice was to not hardcode any limit for base b
  		We let Character>>#digitValue: fail"
+ 		^aStream nextPut: (Character digitValue: self) ].
- 		^Character digitValue: self].
  	halfPower := n bitShift: -1.
  	half := b raisedToInteger: halfPower.
  	head := self quo: half.
  	tail := self - (head * half).
  	head printOn: aStream base: b nDigits: n - halfPower.
  	tail printOn: aStream base: b nDigits: halfPower!




More information about the Squeak-dev mailing list