2,178 questions
Advice
0
votes
6
replies
208
views
C++ compile type endianness for use in macros
I need to layout a structure in two different ways depending on the endianness of the target platform. Currently I'm using an additional pre-compile phase to run a program to test the endianness, and ...
6
votes
2
answers
288
views
How can I reverse the endianness of an integer that is not a byte-multiple size?
All the existing threads I can find for this type of problem only refer to reversing endianness on byte-multiple bit sizes (i.e, 8, 16, 32, etc), but not non-byte-multiple (i.e, 5, 13, 20, etc), so ...
1
vote
1
answer
75
views
Assembly for little-endian xtensa?
I'm trying to assemble some basic testing code for an embedded device I'm reverse-engineering, which runs little-endian xtensa threadx.
From googling the only assembler that seems to support xtensa in ...
7
votes
0
answers
213
views
C++ floating point representation for big/little endian
I'm trying to make a union with a representation of an IEEE 32-bit floating point number. So far, I have this:
#include <cstdint>
struct FloatRepresentation{
union {
float value;
...
0
votes
3
answers
257
views
How to do macro check for endianness without any temp variable?
I was asked to write a macro that checks whether the system is little-endian or big-endian, without using a variable, and for C89.
C89 means lot of solutions requiring more recent versions of C cannot ...
-6
votes
1
answer
105
views
Host to GPU in terms of endianness discrepancy [closed]
I have been told that when it comes to GPU APIs like Vulkan and DirectX and the host is for example little-endian and the GPU is big-endian that you can read for example a 32-bit integer and the ...
0
votes
1
answer
211
views
Reading an IBM PIC S9(09) COMP data from file in python
I was given sample data by the mainframe engineer, for which the COPYBOOK looks like below:
01 CCS001-DETAIL-RECORD.
05 CCS001-REC-TYPE PIC X(01). Should be '1'
05 CCS001-...
2
votes
0
answers
125
views
Convert an integer to IBM PIC S9(09) COMP. type in python
I have the following three values in a CSV file:
1683199814
2087175640
1348771152
I need to write them into a flat file using a python program, which will be loaded into Mainframe DB2 using a COBOL ...
0
votes
0
answers
101
views
What does Byte Order = I mean? [duplicate]
I was looking at the data in the detailed map of my Magellan Roadmate using the hex reader extension in VS Code when I saw some bytes in ASCII format. VS Code's hex editor has an option to display ...
0
votes
1
answer
99
views
How do I decode Jupiter V6 swap instruction data?
So I am trying to decode Jupiter V6 instruction data just like websites like solscan.io do, to see the input token amount, output token amount, mints and such. I've tried to reverse engineer it, every ...
1
vote
1
answer
140
views
How does U32C in ChaCha20 bypass endianness concerns?
While reading the ChaCha20 cipher's source code, I noticed something unusual. The algorithm's constants (like 0x61707865) aren't converted for endianness, yet this doesn't cause issues across ...
5
votes
3
answers
191
views
Why don't multi-character literals respect architecture endianness?
With GCC on Intel x86 , and similarly with NVCC (Cuda),
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
int main() {
uint32_t v = 'abcd';
uint32_t w = ...
2
votes
4
answers
138
views
Confusing result from htons()
When calling htons() on 1 and inspecting the bytes of the output, my (naive) inspection method below appears to show that the output takes the form 0x0100.
I am confident that htons() is doing what it ...
1
vote
3
answers
238
views
ifstream reading binary file as big endian, how do I convert it to little endian?
I'm trying to read a binary file. When I try to read the file at offset 0, it reads in big endian. The file is in little endian, and that's what I am trying to read it as. Keep in mind I'm trying to ...
1
vote
1
answer
167
views
Understanding the endianness of MIPS. Why is data being stored in little endian format but output looks big endian
This MIPS assembly program shown below is meant to count the number of characters in a string. This program was written using the MARS MIPS simulator (available from https://dpetersanderson.github.io/...