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.
  • Author: Markus Nix <mnix@docuverse.de>
  • Version: $Id: BinaryUtils.php,v 1.2 2004/09/08 11:56:11 docuverse_de Exp $
  • Access: public


[ Top ]


Method Detail

add   [line 54]

void add( int $num1, int $num2)

Binary add.
  • Access: public

Parameters:

int   $num1   — 
int   $num2   — 

[ Top ]

bigEndianToBin   [line 556]

string bigEndianToBin( string $byteword)

Big Endian to bin conversion.
  • 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
  • Access: public

Parameters:

string   $byteword   — 

[ Top ]

bigEndianToInt   [line 490]

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

Big Endian to int conversion.
  • 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.
  • Access: public

Parameters:

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

[ Top ]

binToDec   [line 99]

int binToDec( string $binstring)

Bin to dec conversion.
  • Access: public

Parameters:

string   $binstring   — 

[ Top ]

binToDec_fraction   [line 245]

int binToDec_fraction( $inputfraction)

Bin to dec conversion with fractions.
  • Access: public

Parameters:

   $inputfraction   — 

[ Top ]

binToFloat   [line 183]

the binToFloat( &$data, string $data)

Converts a 6 byte binary string to a single-precision floating point number.
  • Return: floating point number
  • Access: public

Parameters:

string   $data   —  the binary string to convert
   &$data   — 

[ Top ]

binToString   [line 208]

string binToString( string $binstring)

Bin to string conversion. For example, return 'hi' for input of '0110100001101001'.
  • Access: public

Parameters:

string   $binstring   — 

[ Top ]

bytestringToGUID   [line 394]

string bytestringToGUID( string $byte_str)

Transform bytestring to GUID.
  • Return: GUID string
  • 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.
  • Access: public

Parameters:

int   $inputdec   — 
int   $padvalue   — 

[ Top ]

decimalBinaryToFloat   [line 731]

float decimalBinaryToFloat( string $binarynumerator)

Transform decimal binary to float.
  • Access: public

Parameters:

string   $binarynumerator   — 

[ Top ]

decToBin   [line 119]

void decToBin( int $number)

Dec to bin conversion.
  • 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
  • Access: public

Parameters:

float   $num   —  the float to convert

[ Top ]

floatToBinaryDecimal   [line 662]

void floatToBinaryDecimal( float $float_val)

Transform float value to binary decimal.
  • Access: public

Parameters:

float   $float_val   — 

[ Top ]

getHexBytes   [line 749]

string getHexBytes( string $string)

Get hex bytes.
  • 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.

  • Access: public

[ Top ]

getTextBytes   [line 770]

string getTextBytes( string $string)

Get text bytes.
  • Access: public

Parameters:

string   $string   — 

[ Top ]

GUIDToBytestring   [line 430]

string GUIDToBytestring( string $guid_str)

Transform GUID to bytestring.
  • Return: byte string
  • Access: public

Parameters:

string   $guid_str   — 

[ Top ]

littleEndianToBin   [line 541]

string littleEndianToBin( string $byteword)

Little Endian to bin conversion.
  • 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
  • Access: public

Parameters:

string   $byteword   — 

[ Top ]

littleEndianToInt   [line 473]

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

Little Endian to int conversion.
  • 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.
  • Access: public

Parameters:

int   $number   — 
int   $minbytes   — 
bool   $synchsafe   — 

[ Top ]

normalizeBinaryPoint   [line 690]

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

Normalize binary points.
  • Access: public

Parameters:

string   $binarypointnumber   — 
int   $maxbits   — 

[ Top ]

performPack   [line 356]

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

Perform pack.
  • Access: public

Parameters:

int   $val   — 
int   $bytes   — 

[ Top ]

performUnpack   [line 375]

int performUnpack( string $val)

Perform unpack.
  • Access: public

Parameters:

string   $val   — 

[ Top ]

subtract   [line 79]

void subtract( int $num1, int $num2)

Binary subtract.
  • Access: public

Parameters:

int   $num1   — 
int   $num2   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:30:26 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.