-
Notifications
You must be signed in to change notification settings - Fork 67
/
ByteArray.extension.st
67 lines (55 loc) · 1.91 KB
/
ByteArray.extension.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Extension { #name : #ByteArray }
{ #category : #'*VMMaker-plugin generation' }
ByteArray class >> ccg: cg prolog: aBlock expr: aString index: anInteger [
^cg
ccgLoad: aBlock
expr: aString
asCharPtrFrom: anInteger
andThen: (cg ccgValBlock: 'isBytes')
]
{ #category : #'*VMMaker-plugin generation' }
ByteArray class >> ccgDeclareCForVar: aSymbolOrString [
^'char *', aSymbolOrString
]
{ #category : #'*VMMaker-coercing' }
ByteArray >> coerceTo: cTypeString sim: interpreterSimulator [
^CLiteralArray on: self
]
{ #category : #'*VMMaker-accessing' }
ByteArray >> long64At: index [
"Answer a 64-bit integer in Smalltalk order (little-endian)."
^self integerAt: index size: 8 signed: true
]
{ #category : #'*VMMaker-accessing' }
ByteArray >> long64At: index put: value [
"I store 64-bit integers in Smalltalk (little-endian) order."
^self integerAt: index put: value size: 8 signed: true
]
{ #category : #'*VMMaker-accessing' }
ByteArray >> longAt: byteIndex [
"Store a 32bit signed integer starting at the given byte offset"
^self integerAt: byteIndex size: 4 signed: true
]
{ #category : #'*VMMaker-accessing' }
ByteArray >> longAt: byteIndex put: aValue [
"Store a 32bit signed integer starting at the given byte offset"
^self integerAt: byteIndex put: aValue size: 4 signed: true
]
{ #category : #'*VMMaker-printing' }
ByteArray >> storeOn: aStream base: base [
aStream nextPutAll: '#['.
self
do: [:each| each storeOn: aStream base: base]
separatedBy: [aStream nextPut: $ ].
aStream nextPut: $]
]
{ #category : #'*VMMaker-accessing' }
ByteArray >> unsignedLong64At: byteOffset [
"Answer a 64-bit integer in Smalltalk order (little-endian)."
^self integerAt: byteOffset size: 8 signed: false
]
{ #category : #'*VMMaker-accessing' }
ByteArray >> unsignedLong64At: byteOffset put: value [
"I store 64-bit integers in Smalltalk (little-endian) order."
^self integerAt: byteOffset put: value size: 8 signed: false
]