1609 digitByteAt:index |
1609 digitByteAt:index |
1610 "return 8 bits of my signed value, starting at byte index. |
1610 "return 8 bits of my signed value, starting at byte index. |
1611 For positive receivers, this is the same as #digitAt:; |
1611 For positive receivers, this is the same as #digitAt:; |
1612 for negative ones, the actual bit representation is returned." |
1612 for negative ones, the actual bit representation is returned." |
1613 |
1613 |
1614 |t digits| |
1614 |digits| |
1615 |
1615 |
1616 %{ |
1616 %{ |
1617 #ifdef __SCHTEAM__ |
1617 #ifdef __SCHTEAM__ |
1618 return context._RETURN( ((STLargeInteger)self).digitByteAt( index.intValue() ) ); |
1618 return context._RETURN( ((STLargeInteger)self).digitByteAt( index.intValue() ) ); |
1619 #endif |
1619 #endif |
1620 %}. |
1620 %}. |
1621 sign >= 0 ifTrue:[ |
1621 sign >= 0 ifTrue:[ |
1622 index > digitByteArray size ifTrue:[ |
1622 index > digitByteArray size ifTrue:[ |
1623 ^ 0 |
1623 ^ 0 |
1624 ]. |
1624 ]. |
1625 ^ digitByteArray at:index. |
1625 ^ digitByteArray at:index. |
1626 ]. |
1626 ]. |
1627 |
1627 |
1628 "/ negative int - do 2's complement here |
1628 "/ negative int - do 2's complement here |
1629 |
1629 digits := (self bitInvert + 1) digitBytes. |
1630 t := self bitInvert + 1. |
|
1631 t setSign:1. |
|
1632 digits := t digitBytes. |
|
1633 index > digits size ifTrue:[ |
1630 index > digits size ifTrue:[ |
1634 ^ 16rFF |
1631 ^ 16rFF |
1635 ]. |
1632 ]. |
1636 ^ digits at:index. |
1633 ^ digits at:index. |
1637 |
1634 |
1638 " |
1635 " |
1639 16r11111111111111111111 negated digitByteAt:1 |
1636 16r11111111111111111111 negated digitByteAt:1 |
1640 0 asLargeInteger digitByteAt:1 |
1637 0 asLargeInteger digitByteAt:1 |
|
1638 -1 asLargeInteger digitByteAt:1 |
|
1639 -1 digitByteAt:1 |
1641 " |
1640 " |
1642 |
1641 |
1643 "Created: / 25.10.1998 / 14:12:21 / cg" |
1642 "Created: / 25.10.1998 / 14:12:21 / cg" |
1644 ! |
1643 ! |
1645 |
1644 |