- outbuf[0] = (code & (uint64_t)0xFF00000000000000ULL) >> 56;
- outbuf[1] = (code & (uint64_t)0x00FF000000000000ULL) >> 48;
- outbuf[2] = (code & (uint64_t)0x0000FF0000000000ULL) >> 40;
- outbuf[3] = (code & (uint64_t)0x000000FF00000000ULL) >> 32;
- outbuf[4] = (code & (uint64_t)0x00000000FF000000ULL) >> 24;
- outbuf[5] = (code & (uint64_t)0x0000000000FF0000ULL) >> 16;
- outbuf[6] = (code & (uint64_t)0x000000000000FF00ULL) >> 8;
- outbuf[7] = (code & (uint64_t)0x00000000000000FFULL) >> 0;
+
+ switch (cmdargs.outformat) {
+ case FMT_B43:
+ case FMT_RAW_BE32:
+ code = ((code & (uint64_t)0xFFFFFFFF00000000ULL) >> 32) |
+ ((code & (uint64_t)0x00000000FFFFFFFFULL) << 32);
+ outbuf[0] = (code & (uint64_t)0xFF00000000000000ULL) >> 56;
+ outbuf[1] = (code & (uint64_t)0x00FF000000000000ULL) >> 48;
+ outbuf[2] = (code & (uint64_t)0x0000FF0000000000ULL) >> 40;
+ outbuf[3] = (code & (uint64_t)0x000000FF00000000ULL) >> 32;
+ outbuf[4] = (code & (uint64_t)0x00000000FF000000ULL) >> 24;
+ outbuf[5] = (code & (uint64_t)0x0000000000FF0000ULL) >> 16;
+ outbuf[6] = (code & (uint64_t)0x000000000000FF00ULL) >> 8;
+ outbuf[7] = (code & (uint64_t)0x00000000000000FFULL) >> 0;
+ break;
+ case FMT_RAW_LE32:
+ outbuf[7] = (code & (uint64_t)0xFF00000000000000ULL) >> 56;
+ outbuf[6] = (code & (uint64_t)0x00FF000000000000ULL) >> 48;
+ outbuf[5] = (code & (uint64_t)0x0000FF0000000000ULL) >> 40;
+ outbuf[4] = (code & (uint64_t)0x000000FF00000000ULL) >> 32;
+ outbuf[3] = (code & (uint64_t)0x00000000FF000000ULL) >> 24;
+ outbuf[2] = (code & (uint64_t)0x0000000000FF0000ULL) >> 16;
+ outbuf[1] = (code & (uint64_t)0x000000000000FF00ULL) >> 8;
+ outbuf[0] = (code & (uint64_t)0x00000000000000FFULL) >> 0;
+ break;
+ }