Math
[ class tree: Math ] [ index: Math ] [ all elements ]

Class: Math_BinaryUtils

Source Location: /Math_BinaryUtils-0.3.0/BinaryUtils.php

Class Overview


Class with static helpers for easy handling of bit and byte stuff.


Author(s):

Version:

  • $Id: BinaryUtils.php,v 1.2 2004/09/08 11:56:11 docuverse_de Exp $

Methods


Inherited Variables

Inherited Methods


Class Details

[line 43]
Class with static helpers for easy handling of bit and byte stuff.
  • Static: This method can be called statically
  • Version: $Id: BinaryUtils.php,v 1.2 2004/09/08 11:56:11 docuverse_de Exp $
  • Access: public
  • Author: Markus Nix <mailto:mnix@docuverse.de>


[ Top ]


Method Detail

add   [line 54]

void add( int $num1, int $num2)

Binary add.
  • Static: This method can be called statically
  • Access: public

Parameters:

int   $num1     
int   $num2     

[ Top ]

bigEndianToBin   [line 556]

string bigEndianToBin( string $byteword)

Big Endian to bin conversion.
  • Static: This method can be called statically
  • Access: public

Parameters:

string   $byteword     

[ Top ]

bigEndianToFloat   [line 593]

mixed bigEndianToFloat( string $byteword)

Big Endian to float conversion.
  • Return: Either float or false on error
  • Static: This method can be called statically
  • Access: public

Parameters:

string   $byteword     

[ Top ]

bigEndianToInt   [line 490]

int bigEndianToInt( string $byteword, [bool $synchsafe = false], [bool $signed = false])

Big Endian to int conversion.
  • Static: This method can be called statically
  • Access: public

Parameters:

string   $byteword     
bool   $synchsafe     
bool   $signed     

[ Top ]

bigEndianToString   [line 319]

string bigEndianToString( int $number, [int $minbytes = 1], [bool $synchsafe = false], [bool $signed = false])

Big Endian to String conversion.
  • Static: This method can be called statically
  • Access: public

Parameters:

int   $number     
int   $minbytes     
bool   $synchsafe     
bool   $signed     

[ Top ]

binToDec   [line 99]

int binToDec( string $binstring)

Bin to dec conversion.
  • Static: This method can be called statically
  • Access: public

Parameters:

string   $binstring     

[ Top ]

binToDec_fraction   [line 245]

int binToDec_fraction( mixed $inputfraction)

Bin to dec conversion with fractions.
  • Static: This method can be called statically
  • Access: public

[ Top ]

binToFloat   [line 183]

the binToFloat( string &$data)

Converts a 6 byte binary string to a single-precision floating point number.
  • Return: floating point number
  • Static: This method can be called statically
  • Access: public

Parameters:

string   $data     the binary string to convert

[ Top ]

binToString   [line 208]

string binToString( string $binstring)

Bin to string conversion. For example, return 'hi' for input of '0110100001101001'.
  • Static: This method can be called statically
  • Access: public

Parameters:

string   $binstring     

[ Top ]

bytestringToGUID   [line 394]

string bytestringToGUID( string $byte_str)

Transform bytestring to GUID.
  • Return: GUID string
  • Static: This method can be called statically
  • Access: public

Parameters:

string   $byte_str     

[ Top ]

decbin_pad   [line 231]

string decbin_pad( int $inputdec, int $padvalue)

Converts Decimal -> Binary, and left-pads it with $padvalue 0's.
  • Static: This method can be called statically
  • Access: public

Parameters:

int   $inputdec     
int   $padvalue     

[ Top ]

decimalBinaryToFloat   [line 731]

float decimalBinaryToFloat( string $binarynumerator)

Transform decimal binary to float.
  • Static: This method can be called statically
  • Access: public

Parameters:

string   $binarynumerator     

[ Top ]

decToBin   [line 119]

void decToBin( int $number)

Dec to bin conversion.
  • Static: This method can be called statically
  • Access: public

Parameters:

int   $number     

[ Top ]

floatToBin   [line 147]

string floatToBin( float $num)

Converts a single-precision floating point number to a 6 byte binary string.
  • Return: the binary string representing the float
  • Static: This method can be called statically
  • Access: public

Parameters:

float   $num     the float to convert

[ Top ]

floatToBinaryDecimal   [line 662]

void floatToBinaryDecimal( float $float_val)

Transform float value to binary decimal.
  • Static: This method can be called statically
  • Access: public

Parameters:

float   $float_val     

[ Top ]

getHexBytes   [line 749]

string getHexBytes( string $string)

Get hex bytes.
  • Static: This method can be called statically
  • Access: public

Parameters:

string   $string     

[ Top ]

getNativeOrder   [line 268]

int getNativeOrder( )

Retrieve native byte order of this OS.

Little Endian: Intel's 80x86 processors and their clones, Big Endian: SPARC, Motorola's 68K, and the PowerPC families.

  • Static: This method can be called statically
  • Access: public

[ Top ]

getTextBytes   [line 770]

string getTextBytes( string $string)

Get text bytes.
  • Static: This method can be called statically
  • Access: public

Parameters:

string   $string     

[ Top ]

GUIDToBytestring   [line 430]

string GUIDToBytestring( string $guid_str)

Transform GUID to bytestring.
  • Return: byte string
  • Static: This method can be called statically
  • Access: public

Parameters:

string   $guid_str     

[ Top ]

littleEndianToBin   [line 541]

string littleEndianToBin( string $byteword)

Little Endian to bin conversion.
  • Static: This method can be called statically
  • Access: public

Parameters:

string   $byteword     

[ Top ]

littleEndianToFloat   [line 578]

mixed littleEndianToFloat( string $byteword)

Little Endian to float conversion.
  • Return: Either float or false on error
  • Static: This method can be called statically
  • Access: public

Parameters:

string   $byteword     

[ Top ]

littleEndianToInt   [line 473]

int littleEndianToInt( string $byteword, [bool $signed = false])

Little Endian to int conversion.
  • Static: This method can be called statically
  • Access: public

Parameters:

string   $byteword     
bool   $signed     

[ Top ]

littleEndianToString   [line 291]

string littleEndianToString( int $number, [int $minbytes = 1], [bool $synchsafe = false])

Little Endian to String conversion.
  • Static: This method can be called statically
  • Access: public

Parameters:

int   $number     
int   $minbytes     
bool   $synchsafe     

[ Top ]

normalizeBinaryPoint   [line 690]

array normalizeBinaryPoint( string $binarypointnumber, [int $maxbits = 52])

Normalize binary points.
  • Static: This method can be called statically
  • Access: public

Parameters:

string   $binarypointnumber     
int   $maxbits     

[ Top ]

performPack   [line 356]

string performPack( int $val, [int $bytes = 2])

Perform pack.
  • Static: This method can be called statically
  • Access: public

Parameters:

int   $val     
int   $bytes     

[ Top ]

performUnpack   [line 375]

int performUnpack( string $val)

Perform unpack.
  • Static: This method can be called statically
  • Access: public

Parameters:

string   $val     

[ Top ]

subtract   [line 79]

void subtract( int $num1, int $num2)

Binary subtract.
  • Static: This method can be called statically
  • Access: public

Parameters:

int   $num1     
int   $num2     

[ Top ]


Documentation generated on Sun, 20 Mar 2005 02:00:05 -0500 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.