Seed7 - The extensible programming language
Seed7 FAQ Manual Screenshots Examples Libraries Algorithms Download Links
Libraries AES ARC4 Array ASN.1 Bigfile Bigint Bigrat Bin32 Bin64 Bitdata Bitmapfont Bitset Bitsetof Boolean Browser Bstring Bytedata Cards Category CC config Cgi Cgi dialog Char Charsets Cipher Clib_file Color CLI Commands Complex Console Crc32 Deflate DES Dialog Dir Draw Duration Echo Editline Enable_input Enable_io Enable_output Encoding Environment External_file File File system Float Font Forloop Ftp Getf Gethttp Gethttps Graph Graph_file Gzip Hash Hashsetof Hmac Html_ent Httpserv Idxarray Image Inflate Inflate file Inifile Integer Keybd Line Listener LZW Make Math Msgdigest Null_file Osfiles Picture utility Pixmap_file Pixmapfont PKCS #1 Poll Process Progs Propertyfile Rational Reference Ref_list Scanfile Scanstri Set Shell Smtp Sockbase Socket SQL base Stdio Strifile String Stritext Subrange Tar Text Time TLS/SSL Triple DES Unicode Utf16 Utf8 Vectorfont 3D Vector Window Wrinum X.509 Xmldom Xml_ent Zip
Libraries
Bin32 Source Code
 previous   up   next 

Types
bin32
Binary values with 32 bits.

bin32

const type: bin32

Binary values with 32 bits. This type is intended for bit operations that are not defined for integer values. The internal representation is the same as for integer.


Operator Summary
integer
(attr integer) conv (in bin32: binValue)
Convert to integer.
bin32
(attr bin32) conv (in integer: anInt)
Convert to bin32.
string
(in bin32: number) radix (in integer: base)
Convert a bin32 value to a string using a radix.
string
(in bin32: number) RADIX (in integer: base)
Convert a bin32 value to a string using a radix.
boolean
(in bin32: binary1) = (in bin32: binary2)
Check if two bin32 values are equal.
boolean
(in bin32: binary1) <> (in bin32: binary2)
Check if two bin32 values are not equal.
bin32
(in bin32: binary1) & (in bin32: binary2)
Compute a bitwise and of two bin32 values.
bin32
(in bin32: binary1) | (in bin32: binary2)
Compute a bitwise inclusive or of two bin32 values.
bin32
(in bin32: binary1) >< (in bin32: binary2)
Compute a bitwise exclusive or (xor) of two bin32 values.
bin32
~ (in bin32: aBinary)
Compute a bitwise not of a bin32 value.
bin32
(in bin32: binValue) << (in integer: lshift)
Shift a bin32 value left by lshift bits.
bin32
(in bin32: binValue) >> (in integer: lshift)
Shift a bin32 value right by rshift bits.
void
(inout bin32: binValue) <<:= (in integer: lshift)
Shift a bin32 value left by lshift bits and assign the result back to binValue.
void
(inout bin32: binValue) >>:= (in integer: rshift)
Shift a bin32 value right by rshift bits and assign the result back to binValue.
void
(inout bin32: binary1) &:= (in bin32: binary2)
Compute a bitwise and and assign the result back to binary1.
void
(inout bin32: binary1) |:= (in bin32: binary2)
Compute a bitwise inclusive or and assign the result back to binary1.
void
(inout bin32: binary1) ><:= (in bin32: binary2)
Compute a bitwise exclusive or (xor) and assign the result back to binary1.

Function Summary
integer
ord (in bin32: binValue)
Convert to integer.
bin32
bin32 (in integer: number)
Convert to bin32.
bin32
bin32 (in char: ch)
Convert to bin32.
bin32
bin32 (in float: number)
Convert to bin32.
float
float (in bin32: bits)
Convert to float.
integer
compare (in bin32: number1, in bin32: number2)
Compare two bin32 values.
integer
hashCode (in bin32: number)
Compute the hash value of a bin32 value.
bin32
rand (attr bin32)
Compute pseudo-random bin32 value.
string
str (in bin32: number)
Convert an bin32 value to a string.
bin32
rotLeft (in bin32: x, in integer: shiftCount)
Rotate the bits of a bin32 value left by shiftCount bits.
bin32
rotRight (in bin32: x, in integer: shiftCount)
Rotate the bits of a bin32 value right by shiftCount bits.
bin32
float2Bits (in float: number, SINGLE)
Get bits in IEEE 754 single-precision representation from a float.
float
bits2Float (in bin32: bits)
Get a float from bits in IEEE 754 single-precision representation.
bin32
float2MbfBits (in float: number, SINGLE)
Get bits in MBF single-precision representation from a float.
float
mbfBits2Float (in bin32: bits)
Get a float from bits in MBF single-precision representation.
bin32
bin32 (in string: fourBytes, LE)
Convert a string of four little-endian bytes to a bin32 value.
bin32
bin32 (in string: fourBytes, BE)
Convert a string of four big-endian bytes to a bin32 value.
string
bin32AsFourBytesLe (in bin32: binValue)
Convert 32 lower bits of a bin32 value into four little-endian chars.
string
bin32AsFourBytesBe (in bin32: binValue)
Convert 32 lower bits of a bin32 value into four big-endian chars.

Operator Detail

conv

const func integer: (attr integer) conv (in bin32: binValue)

Convert to integer.

Returns:
the unchanged value as integer.

conv

const func bin32: (attr bin32) conv (in integer: anInt)

Convert to bin32.

Returns:
the unchanged value as bin32.

radix

const func string: (in bin32: number) radix (in integer: base)

Convert a bin32 value to a string using a radix. The conversion uses the numeral system with the given base. Digit values from 10 upward are encoded with lower case letters. E.g.: 10 is encoded with a, 11 with b, etc.

Returns:
the string result of the conversion.
Raises:
RANGE_ERROR - When base < 2 or base > 36 holds.
MEMORY_ERROR - Not enough memory to represent the result.

RADIX

const func string: (in bin32: number) RADIX (in integer: base)

Convert a bin32 value to a string using a radix. The conversion uses the numeral system with the given base. Digit values from 10 upward are encoded with upper case letters. E.g.: 10 is encoded with A, 11 with B, etc.

Returns:
the string result of the conversion.
Raises:
RANGE_ERROR - When base < 2 or base > 36 holds.
MEMORY_ERROR - Not enough memory to represent the result.

=

const func boolean: (in bin32: binary1) = (in bin32: binary2)

Check if two bin32 values are equal.

Returns:
TRUE if the two values are equal, FALSE otherwise.

<>

const func boolean: (in bin32: binary1) <> (in bin32: binary2)

Check if two bin32 values are not equal.

Returns:
FALSE if both values are equal, TRUE otherwise.

&

const func bin32: (in bin32: binary1) & (in bin32: binary2)

Compute a bitwise and of two bin32 values.

Returns:
the bitwise and of the two values.

|

const func bin32: (in bin32: binary1) | (in bin32: binary2)

Compute a bitwise inclusive or of two bin32 values.

Returns:
the bitwise inclusive or of the two values.

><

const func bin32: (in bin32: binary1) >< (in bin32: binary2)

Compute a bitwise exclusive or (xor) of two bin32 values.

Returns:
the bitwise xor of the two values.

~

const func bin32: ~ (in bin32: aBinary)

Compute a bitwise not of a bin32 value.

Returns:
the bitwise not of the value.

<<

const func bin32: (in bin32: binValue) << (in integer: lshift)

Shift a bin32 value left by lshift bits.

Returns:
the left shifted value.
Raises:
OVERFLOW_ERROR - When the shift amount is negative or greater equal 64.

>>

const func bin32: (in bin32: binValue) >> (in integer: lshift)

Shift a bin32 value right by rshift bits. Bits shifted beyond the lowest bit position are lost.

Returns:
the right shifted value.
Raises:
OVERFLOW_ERROR - When the shift amount is negative or greater equal 64.

<<:=

const proc: (inout bin32: binValue) <<:= (in integer: lshift)

Shift a bin32 value left by lshift bits and assign the result back to binValue.

Raises:
OVERFLOW_ERROR - When the shift amount is negative or greater equal 64.

>>:=

const proc: (inout bin32: binValue) >>:= (in integer: rshift)

Shift a bin32 value right by rshift bits and assign the result back to binValue. Bits shifted beyond the lowest bit position are lost.

Raises:
OVERFLOW_ERROR - When the shift amount is negative or greater equal 64.

&:=

const proc: (inout bin32: binary1) &:= (in bin32: binary2)

Compute a bitwise and and assign the result back to binary1.


|:=

const proc: (inout bin32: binary1) |:= (in bin32: binary2)

Compute a bitwise inclusive or and assign the result back to binary1.


><:=

const proc: (inout bin32: binary1) ><:= (in bin32: binary2)

Compute a bitwise exclusive or (xor) and assign the result back to binary1.


Function Detail

ord

const func integer: ord (in bin32: binValue)

Convert to integer.

Returns:
the unchanged value as integer.

bin32

const func bin32: bin32 (in integer: number)

Convert to bin32.

Returns:
the unchanged value as bin32.

bin32

const func bin32: bin32 (in char: ch)

Convert to bin32.

Returns:
the unchanged value as bin32.

bin32

const func bin32: bin32 (in float: number)

Convert to bin32. Get bits in IEEE 754 single-precision representation from a float.

Parameters:
number - Float value to be converted to bin32.
Returns:
32 bits in IEEE 754 single-precision float representation.

float

const func float: float (in bin32: bits)

Convert to float. Get a float from bits in IEEE 754 single-precision representation.

Parameters:
bits - Bits to be converted to a float.
Returns:
a float from bits in single-precision float representation.

compare

const func integer: compare (in bin32: number1, in bin32: number2)

Compare two bin32 values.

Returns:
-1, 0 or 1 if the first argument is considered to be respectively less than, equal to, or greater than the second.

hashCode

const func integer: hashCode (in bin32: number)

Compute the hash value of a bin32 value.

Returns:
the hash value.

rand

const func bin32: rand (attr bin32)

Compute pseudo-random bin32 value. The random values are uniform distributed.

Returns:
a random bin32 value.

str

const func string: str (in bin32: number)

Convert an bin32 value to a string. The values is converted to a string with decimal representation.

Returns:
the string result of the conversion.
Raises:
MEMORY_ERROR - Not enough memory to represent the result.

rotLeft

const func bin32: rotLeft (in bin32: x, in integer: shiftCount)

Rotate the bits of a bin32 value left by shiftCount bits. The vacant bit positions at the right side are filled in with the bits that are shifted out at the left side.

Returns:
the left rotated value.
Raises:
OVERFLOW_ERROR - When the shift amount is negative or greater than 32.

rotRight

const func bin32: rotRight (in bin32: x, in integer: shiftCount)

Rotate the bits of a bin32 value right by shiftCount bits. The vacant bit positions at the left side are filled in with the bits that are shifted out at the right side.

Returns:
the right rotated value.
Raises:
OVERFLOW_ERROR - When the shift amount is negative or greater than 32.

float2Bits

const func bin32: float2Bits (in float: number, SINGLE)

Get bits in IEEE 754 single-precision representation from a float.

Parameters:
number - Float value to be converted to bin32.
Returns:
32 bits in IEEE 754 single-precision float representation.

bits2Float

const func float: bits2Float (in bin32: bits)

Get a float from bits in IEEE 754 single-precision representation.

Parameters:
bits - Bits to be converted to a float.
Returns:
a float from bits in single-precision float representation.

float2MbfBits

const func bin32: float2MbfBits (in float: number, SINGLE)

Get bits in MBF single-precision representation from a float. Microsoft Binary Format (MBF) is a format for floating point numbers. The single-precision version of MBF has a 8 bit exponent, a sign bit and a 23 bit mantissa.

Parameters:
number - Float value to be converted to bin32.
Returns:
32 bits in MBF single-precision float representation.
Raises:
RANGE_ERROR - When number is not representable in MBF. NaN, Infinity and -Infinity are not representable in MBF. Numbers with an absolut value larger than 1.7014117331926443e+38 are also not representable in MBF.

mbfBits2Float

const func float: mbfBits2Float (in bin32: bits)

Get a float from bits in MBF single-precision representation. Microsoft Binary Format (MBF) is a format for floating point numbers. The single-precision version of MBF has a 8 bit exponent, a sign bit and a 23 bit mantissa.

Parameters:
bits - Bits to be converted to a float.
Returns:
a float from bits in MBF single-precision float representation.

bin32

const func bin32: bin32 (in string: fourBytes, LE)

Convert a string of four little-endian bytes to a bin32 value.

Returns:
the bin32 value.

bin32

const func bin32: bin32 (in string: fourBytes, BE)

Convert a string of four big-endian bytes to a bin32 value.

Returns:
the bin32 value.

bin32AsFourBytesLe

const func string: bin32AsFourBytesLe (in bin32: binValue)

Convert 32 lower bits of a bin32 value into four little-endian chars.

Returns:
a string of length four with the little-endian representation.

bin32AsFourBytesBe

const func string: bin32AsFourBytesBe (in bin32: binValue)

Convert 32 lower bits of a bin32 value into four big-endian chars.

Returns:
a string of length four with the big-endian representation.


 previous   up   next