Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

Graphical examples over the network to different endianness

Black Belt

It is possible to run the graphical examples over the network, e.g., using "ssh -X". However, if client and server use different endianness, the colours look unfamiliar compared to an all-local setup.

If you're familiar with the X Window System, you might consider contributing a solution that uses XImage::byte_order to conditionally swap the bytes returned from get_color() and whatever else is needed to make this problem go away, so I can go read a book instead (I'm getting only partial success so far). :-)

0 Kudos
1 Reply
Black Belt

Never mind, it's a writeable field:



    // Note: It may be more efficient to adopt the server's byte order

    //       and swap once per get_color() call instead of once per pixel.

    const uint32_t probe =0x03020100;

    const bool big_endian = (((const char*)(&probe))[0]==0x03);

    ximage->byte_order = big_endian ? MSBFirst : LSBFirst;