REXX Tips & Tricks, Version 2.80


Inf-HTML [About][Toc][Index] 0.9b (c) 1995 Peter Childs


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
  RETURN strip( translate( "12345678", arg(1), "78563412" ) )

  

Inf-HTML End Run - Successful