Announcement

Collapse
No announcement yet.

Convert 4 byte hex arrays to 2 int hex arrays

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • edha
    replied
    Thank you.

    Leave a comment:


  • ESPsupport
    replied
    destination[0] := source[0] << 8 + source[1] ;
    destination[1] := source[2] << 8 + source[3] ;

    Leave a comment:


  • edha
    started a topic Convert 4 byte hex arrays to 2 int hex arrays

    Convert 4 byte hex arrays to 2 int hex arrays

    How to convert 4 byte hex arrays to 2 int hex arrays?

    Example:
    // 4 byte hex array (source)
    source[0] := 0x12;
    source[1] := 0x34;
    source[2] := 0x56;
    source[3] := 0x78;

    // 2 int hex array (destination)
    destination[0] := 0x1234; // source[0] and source[1] save in here
    destination[1] := 0x5678; // source[2] and source[3] save in here
Working...
X