SignedWordArray.st
author Claus Gittinger <cg@exept.de>
Tue, 26 Feb 2008 11:29:14 +0100
changeset 1930 935b2870be2e
parent 1177 f81425b27be5
child 2642 e69731982fa9
permissions -rw-r--r--
arrow points reusable (class protocol)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
883
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
     1
"
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
     2
 COPYRIGHT (c) 1997 eXept Software AG
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
     3
              All Rights Reserved
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
     4
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
     5
 This software is furnished under a license and may be used
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
     6
 only in accordance with the terms of that license and with the
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
     8
 be provided or otherwise made available to, or used by, any
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
     9
 other person.  No title to or ownership of the software is
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    10
 hereby transferred.
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    11
"
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    12
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    13
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    14
1177
f81425b27be5 inheritance & documentation
Claus Gittinger <cg@exept.de>
parents: 883
diff changeset
    15
"{ Package: 'stx:libbasic2' }"
f81425b27be5 inheritance & documentation
Claus Gittinger <cg@exept.de>
parents: 883
diff changeset
    16
f81425b27be5 inheritance & documentation
Claus Gittinger <cg@exept.de>
parents: 883
diff changeset
    17
UnboxedIntegerArray variableSignedWordSubclass:#SignedWordArray
557
fb9679c8c054 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	instanceVariableNames:''
fb9679c8c054 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	classVariableNames:''
fb9679c8c054 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	poolDictionaries:''
fb9679c8c054 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
	category:'Collections-Arrayed'
fb9679c8c054 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
!
fb9679c8c054 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
fb9679c8c054 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
!SignedWordArray class methodsFor:'documentation'!
fb9679c8c054 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
883
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    26
copyright
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    27
"
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    28
 COPYRIGHT (c) 1997 eXept Software AG
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    29
              All Rights Reserved
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    30
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    31
 This software is furnished under a license and may be used
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    32
 only in accordance with the terms of that license and with the
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    33
 inclusion of the above copyright notice.   This software may not
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    34
 be provided or otherwise made available to, or used by, any
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    35
 other person.  No title to or ownership of the software is
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    36
 hereby transferred.
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    37
"
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    38
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    39
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    40
!
af72d62dc635 copyrights
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    41
557
fb9679c8c054 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
documentation
fb9679c8c054 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
"
703
a0a2d6178de4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 557
diff changeset
    44
    SignedWordArrays store 16bit signed integers in the range -16r8000..16r7FFF.
557
fb9679c8c054 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
    They are much like WordArrays, but the values stored are signed.
fb9679c8c054 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
    In contrast to normal arrays (which store pointers to their elements),
fb9679c8c054 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
    signedWordArrays store the values in a dense & compact way. 
1177
f81425b27be5 inheritance & documentation
Claus Gittinger <cg@exept.de>
parents: 883
diff changeset
    48
    Since the representation fits the underlying C-language systems representation
f81425b27be5 inheritance & documentation
Claus Gittinger <cg@exept.de>
parents: 883
diff changeset
    49
    of signed int16's, this is also useful to pass bulk data to c primitive code.
f81425b27be5 inheritance & documentation
Claus Gittinger <cg@exept.de>
parents: 883
diff changeset
    50
f81425b27be5 inheritance & documentation
Claus Gittinger <cg@exept.de>
parents: 883
diff changeset
    51
    Therefore, SignedWordArrays can be used to hold bulk data in a more compact way.
736
db164846b078 documentation
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    52
        For example:
db164846b078 documentation
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    53
            Array new:100000 withAll:1
db164846b078 documentation
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    54
        requires 400k of object memory;
557
fb9679c8c054 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
736
db164846b078 documentation
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    56
        in contrast,
1177
f81425b27be5 inheritance & documentation
Claus Gittinger <cg@exept.de>
parents: 883
diff changeset
    57
            SignedWordArray new:100000 withAll:1
736
db164846b078 documentation
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    58
        only requires half of it.
db164846b078 documentation
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    59
db164846b078 documentation
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    60
    [memory requirements:]
db164846b078 documentation
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    61
        OBJ-HEADER + (size * 2)
557
fb9679c8c054 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
fb9679c8c054 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
    [see also:]
736
db164846b078 documentation
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    64
        ByteArray WordArray BooleanArray FloatArray DoubleArray Array
db164846b078 documentation
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    65
        IntegerArray LongIntegerArray SignedLongIntegerArray
557
fb9679c8c054 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
fb9679c8c054 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
    [author:]
736
db164846b078 documentation
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    68
        Claus Gittinger
557
fb9679c8c054 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
"
fb9679c8c054 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
! !
fb9679c8c054 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
fb9679c8c054 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
!SignedWordArray class methodsFor:'documentation'!
fb9679c8c054 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
fb9679c8c054 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
version
1177
f81425b27be5 inheritance & documentation
Claus Gittinger <cg@exept.de>
parents: 883
diff changeset
    75
    ^ '$Header: /cvs/stx/stx/libbasic2/SignedWordArray.st,v 1.5 2003-04-22 09:39:29 cg Exp $'
557
fb9679c8c054 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
! !