[Toc][Index]

Convert values from/to INTEL format



On Intel processors words and doublewords are saved in the so-called INTEL 
format (LSB - last signifcant byte first). To use them, you must convert 
them into the MSB format (MSB - most significant byte first). 
Before using the following routine, you must convert the value into a hex 
string (see Get the display resolution for an example). 

 
/* ------------------------------------------------------------------ */
/* function: Convert an WORD or DWORD from LSB format to MSB format   */
/*           and vice versa                                           */
/*                                                                    */
/* call:     LSB2MSB inputHexString                                   */
/*                                                                    */
/* where:    inputHexstring - input value as hexstring                */
/*                            (e.g. "3412", "78563412")               */
/*                                                                    */
/* output:   value in MSB format as hexstring                         */
/*           (e.g. "1234", "12345678")                                */
/*                                                                    */
LSB2MSB: PROCEDURE
  HexZiffer = arg(1)                                         /* v3.00 */
  Len = Length(HexZiffer)                                    /* v3.00 */
  If (Len // 2) then                                         /* v3.00 */
     HexZiffer = Right(HexZiffer, Len + 1, '0')              /* v3.00 */
  RETURN strip( translate( "12345678",,                      /* v3.00 */
                           HexZiffer, "78563412" ) )         /* v3.00 */

  

Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs