Commit f3ed1488 authored by Stan Moore's avatar Stan Moore
Browse files

Fix for big endian machines

parent 40e776eb
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -291,6 +291,17 @@ int HostThreadTeamData::rendezvous( int64_t * const buffer
                       + ( ( rank & ~mask_byte ) << shift_mem_cycle )
                       + ( sync_offset << shift_byte );

      // Switch designated byte if running on big endian machine
      volatile uint16_t value = 1;
      volatile uint8_t* byte = (uint8_t*) &value;
      volatile bool is_big_endian = (!(byte[0] == 1));
      if (is_big_endian) {
        int remainder = ((offset) % 8);
        int base = offset - remainder;
        int shift = 7 - remainder;
        offset = base + shift;
      }

      // All of this thread's previous memory stores must be complete before
      // this thread stores the step value at this thread's designated byte
      // in the shared synchronization array.
+11 −0
Original line number Diff line number Diff line
@@ -137,6 +137,17 @@ int rendezvous( volatile int64_t * const buffer
                       + ( ( rank & ~mask_byte ) << shift_mem_cycle )
                       + ( sync_offset << shift_byte );

      // Switch designated byte if running on big endian machine
      volatile uint16_t value = 1;
      volatile uint8_t* byte = (uint8_t*) &value;
      volatile bool is_big_endian = (!(byte[0] == 1));
      if (is_big_endian) {
        int remainder = ((offset) % 8);
        int base = offset - remainder;
        int shift = 7 - remainder;
        offset = base + shift;
      }

      // All of this thread's previous memory stores must be complete before
      // this thread stores the step value at this thread's designated byte
      // in the shared synchronization array.