23965
|
1 |
"{ Encoding: utf8 }"
|
|
2 |
|
20649
|
3 |
"
|
|
4 |
COPYRIGHT (c) 1997 eXept Software AG
|
|
5 |
All Rights Reserved
|
|
6 |
|
|
7 |
This software is furnished under a license and may be used
|
|
8 |
only in accordance with the terms of that license and with the
|
|
9 |
inclusion of the above copyright notice. This software may not
|
|
10 |
be provided or otherwise made available to, or used by, any
|
|
11 |
other person. No title to or ownership of the software is
|
|
12 |
hereby transferred.
|
|
13 |
"
|
|
14 |
"{ Package: 'stx:libbasic' }"
|
|
15 |
|
|
16 |
"{ NameSpace: Smalltalk }"
|
|
17 |
|
|
18 |
UnboxedIntegerArray variableSignedWordSubclass:#SignedWordArray
|
|
19 |
instanceVariableNames:''
|
|
20 |
classVariableNames:''
|
|
21 |
poolDictionaries:''
|
|
22 |
category:'Collections-Arrayed'
|
|
23 |
!
|
|
24 |
|
|
25 |
!SignedWordArray class methodsFor:'documentation'!
|
|
26 |
|
|
27 |
copyright
|
|
28 |
"
|
|
29 |
COPYRIGHT (c) 1997 eXept Software AG
|
|
30 |
All Rights Reserved
|
|
31 |
|
|
32 |
This software is furnished under a license and may be used
|
|
33 |
only in accordance with the terms of that license and with the
|
|
34 |
inclusion of the above copyright notice. This software may not
|
|
35 |
be provided or otherwise made available to, or used by, any
|
|
36 |
other person. No title to or ownership of the software is
|
|
37 |
hereby transferred.
|
|
38 |
"
|
|
39 |
|
|
40 |
|
|
41 |
!
|
|
42 |
|
|
43 |
documentation
|
|
44 |
"
|
22272
|
45 |
SignedWordArrays store 16bit signed integers in the range 16r-8000..16r7FFF.
|
20649
|
46 |
They are much like WordArrays, but the values stored are signed.
|
|
47 |
In contrast to normal arrays (which store pointers to their elements),
|
|
48 |
signedWordArrays store the values in a dense & compact way.
|
|
49 |
Since the representation fits the underlying C-language systems representation
|
|
50 |
of signed int16's, this is also useful to pass bulk data to c primitive code.
|
|
51 |
|
|
52 |
Therefore, SignedWordArrays can be used to hold bulk data in a more compact way.
|
|
53 |
For example:
|
|
54 |
Array new:100000 withAll:1
|
|
55 |
requires 400k of object memory;
|
|
56 |
|
|
57 |
in contrast,
|
|
58 |
SignedWordArray new:100000 withAll:1
|
|
59 |
only requires half of it.
|
|
60 |
|
|
61 |
[memory requirements:]
|
|
62 |
OBJ-HEADER + (size * 2)
|
|
63 |
|
|
64 |
[see also:]
|
|
65 |
ByteArray WordArray BooleanArray FloatArray DoubleArray Array
|
|
66 |
IntegerArray LongIntegerArray SignedLongIntegerArray
|
|
67 |
|
23965
|
68 |
[caveat:]
|
|
69 |
should probably be renamed to SignedInt16Array
|
|
70 |
|
20649
|
71 |
[author:]
|
|
72 |
Claus Gittinger
|
|
73 |
"
|
|
74 |
! !
|
|
75 |
|
22272
|
76 |
|
20649
|
77 |
!SignedWordArray class methodsFor:'queries'!
|
|
78 |
|
|
79 |
elementByteSize
|
|
80 |
"for bit-like containers, return the number of bytes stored per element.
|
|
81 |
Here, 2 is returned"
|
|
82 |
|
|
83 |
^ 2
|
|
84 |
|
|
85 |
"Created: / 15-09-2011 / 14:11:18 / cg"
|
|
86 |
!
|
|
87 |
|
|
88 |
maxVal
|
|
89 |
"the maximum value which can be stored in instances of me.
|
|
90 |
For SignedWordArrays, this is 16r7FFF (largest 16bit signed int)"
|
|
91 |
|
|
92 |
^ 16r7FFF
|
|
93 |
!
|
|
94 |
|
|
95 |
minVal
|
|
96 |
"the minimum value which can be stored in instances of me.
|
|
97 |
For SignedWordArrays, this is -16r8000 (smallest 16bit signed int)"
|
|
98 |
|
22272
|
99 |
^ 16r-8000
|
|
100 |
|
|
101 |
"Modified (format): / 19-09-2017 / 16:31:41 / stefan"
|
20649
|
102 |
! !
|
|
103 |
|
22272
|
104 |
|
20649
|
105 |
!SignedWordArray class methodsFor:'documentation'!
|
|
106 |
|
|
107 |
version
|
|
108 |
^ '$Header$'
|
|
109 |
!
|
|
110 |
|
|
111 |
version_CVS
|
|
112 |
^ '$Header$'
|
|
113 |
! !
|
|
114 |
|