# HG changeset patch # User Jan Vrany # Date 1620901594 -3600 # Node ID dffa84757e23a154988c65c2ff3475b00a424c8a # Parent 565bf29e3a20d159429590635f960868b053244b Add more compatibility methods to `UninterpretedBytes` diff -r 565bf29e3a20 -r dffa84757e23 UninterpretedBytes.st --- a/UninterpretedBytes.st Wed May 05 10:40:40 2021 +0100 +++ b/UninterpretedBytes.st Thu May 13 11:26:34 2021 +0100 @@ -3,6 +3,7 @@ " COPYRIGHT (c) 1993 by Claus Gittinger COPYRIGHT (c) 2018 Jan Vrany + COPYRIGHT (c) 2021 LabWare All Rights Reserved This software is furnished under a license and may be used @@ -70,6 +71,7 @@ " COPYRIGHT (c) 1993 by Claus Gittinger COPYRIGHT (c) 2018 Jan Vrany + COPYRIGHT (c) 2021 LabWare All Rights Reserved This software is furnished under a license and may be used @@ -1298,6 +1300,28 @@ "Modified: 1.7.1996 / 21:12:13 / cg" ! +unsignedByteAt:index + "return the 1 byte at index as an (unsigned) Integer. + The index is a smalltalk index (i.e. 1-based)." + + ^ self at:index + + " + |b| + + b := ByteArray withAll:#(255 2 3 4). + (b unsignedByteAt:1) printStringRadix:16 + " + + "Created: / 13-05-2021 / 11:19:13 / Jan Vrany " +! + +unsignedByteAt:index put: value + ^ self at:index put: value + + "Created: / 13-05-2021 / 11:20:00 / Jan Vrany " +! + unsignedLongAt:index "return the 4-bytes starting at index as an (unsigned) Integer. The index is a smalltalk index (i.e. 1-based). @@ -1384,6 +1408,25 @@ "Modified: / 5.3.1998 / 11:47:30 / stefan" ! +unsignedLongLongAt:index + "return the 8-bytes starting at index as an (unsigned) Integer. + The index is a smalltalk index (i.e. 1-based). + The value is retrieved in the machine's natural byte order. + Subclasses may redefine this for better performance. + Same as doubleWordAt: for protocol completeness" + + ^ self unsignedInt64At:index MSB:self isBigEndian + + " + |b| + + b := ByteArray withAll:#(1 2 3 4 5 6 7 8). + (b unsignedLongLongAt:1) printStringRadix:16 + " + + "Created: / 13-05-2021 / 11:15:34 / Jan Vrany " +! + unsignedLongLongAt:index bigEndian:msb "return the 8-bytes starting at index as an (unsigned) Integer. The index is a smalltalk index (i.e. 1-based). @@ -5057,6 +5100,11 @@ version_CVS ^ '$Header$' +! + +version_HG + + ^ '$Changeset: $' ! !