comment/format in:
authorClaus Gittinger <cg@exept.de>
Mon, 26 Sep 2011 11:58:22 +0200
changeset 13724 69a4c9dc2f22
parent 13723 5e72c5ef9936
child 13725 90db4d7613ee
comment/format in: #bcdByteAt: #bcdByteAt:put: #signedByteAt: #signedByteAt:put: category of:51 methods
UninterpretedBytes.st
--- a/UninterpretedBytes.st	Mon Sep 26 11:52:55 2011 +0200
+++ b/UninterpretedBytes.st	Mon Sep 26 11:58:22 2011 +0200
@@ -390,22 +390,28 @@
 !UninterpretedBytes methodsFor:'accessing-bytes'!
 
 bcdByteAt:index
-    "return the bcd-value for a byte at index."
+    "return the bcd-value for a byte at index in the range 0..99.
+     BCD treats nibbles (4-bit) as an encoded decimal number's digits
+     (i.e. the value n is encoded as: ((n // 10) * 16) + (n \\ 10)"
 
     ^ (self byteAt:index) decodeFromBCD
 
     "
-     #[ 16r55 ] bcdByteAt:1
-     #[ 16r99] bcdByteAt:1
+     #[ 16r55 ] bcdByteAt:1  
+     #[ 16r99] bcdByteAt:1   
      #[ 16rAA] bcdByteAt:1
     "
+
+    "Modified (comment): / 26-09-2011 / 11:57:33 / cg"
 !
 
 bcdByteAt:index put:aNumber
-    "set the byte at index as bcd-value."
+    "set the byte at index as bcd-value in the range 0..99.
+     BCD treats nibbles (4-bit) as an encoded decimal number's digits
+     (i.e. the value n is encoded as: ((n // 10) * 16) + (n \\ 10)"
 
     (aNumber between:0 and:99) ifFalse:[
-	self error:'invalid value for BCD encoding'
+        self error:'invalid value for BCD encoding'
     ].
     ^ self byteAt:index put:aNumber encodeAsBCD
 
@@ -415,10 +421,12 @@
      (((ByteArray new:1) bcdByteAt:1 put:100; yourself) at:1) hexPrintString
      (((ByteArray new:1) bcdByteAt:1 put:-1; yourself) at:1) hexPrintString
     "
+
+    "Modified (comment): / 26-09-2011 / 11:57:36 / cg"
 !
 
 signedByteAt:index
-    "return the byte at index as a signed 8 bit value.
+    "return the byte at index as a signed 8 bit value in the range -128..+127.
      The index is a smalltalk index (i.e. 1-based).
      This may be worth a primitive."
 
@@ -432,11 +440,12 @@
      b signedByteAt:1
     "
 
-    "Modified: 1.7.1996 / 21:13:53 / cg"
+    "Modified: / 01-07-1996 / 21:13:53 / cg"
+    "Modified (comment): / 26-09-2011 / 11:57:14 / cg"
 !
 
 signedByteAt:index put:aSignedByteValue
-    "return the byte at index as a signed 8 bit value.
+    "return the byte at index as a signed 8 bit value in the range -128..+127.
      The index is a smalltalk index (i.e. 1-based).
      Return the signedByteValue argument.
      This may be worth a primitive."
@@ -444,9 +453,9 @@
     |b "{ Class: SmallInteger }"|
 
     aSignedByteValue >= 0 ifTrue:[
-	b := aSignedByteValue
+        b := aSignedByteValue
     ] ifFalse:[
-	b := 16r100 + aSignedByteValue
+        b := 16r100 + aSignedByteValue
     ].
     self at:index put:b.
     ^ aSignedByteValue
@@ -458,7 +467,8 @@
      b at:1
     "
 
-    "Modified: 1.7.1996 / 21:12:37 / cg"
+    "Modified: / 01-07-1996 / 21:12:37 / cg"
+    "Modified (comment): / 26-09-2011 / 11:57:18 / cg"
 ! !
 
 !UninterpretedBytes methodsFor:'accessing-floats & doubles'!
@@ -834,7 +844,7 @@
     "Created: / 5.3.1998 / 10:51:11 / stefan"
 ! !
 
-!UninterpretedBytes methodsFor:'accessing-longlongs'!
+!UninterpretedBytes methodsFor:'accessing-longlongs (64bit)'!
 
 longLongAt:index
     "return the 8-bytes starting at index as a signed Integer.
@@ -1068,7 +1078,7 @@
     "Created: / 5.3.1998 / 14:06:02 / stefan"
 ! !
 
-!UninterpretedBytes methodsFor:'accessing-longs'!
+!UninterpretedBytes methodsFor:'accessing-longs (32bit)'!
 
 doubleWordAt:index
     "return the 4-bytes starting at index as an (unsigned) Integer.
@@ -1850,7 +1860,7 @@
     "Modified: / 5.3.1998 / 11:47:30 / stefan"
 ! !
 
-!UninterpretedBytes methodsFor:'accessing-shorts'!
+!UninterpretedBytes methodsFor:'accessing-shorts (16bit)'!
 
 shortAt:index
     "return the 2-bytes starting at index as a signed Integer.
@@ -2901,9 +2911,9 @@
 !UninterpretedBytes class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/UninterpretedBytes.st,v 1.79 2011-08-09 23:41:11 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/UninterpretedBytes.st,v 1.80 2011-09-26 09:58:22 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/UninterpretedBytes.st,v 1.79 2011-08-09 23:41:11 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/UninterpretedBytes.st,v 1.80 2011-09-26 09:58:22 cg Exp $'
 ! !