endianness Questions
2
Solved
The endianness of bitfields is implementation defined. Is there a way to check, at compile time, whether via some macro or other compiler flag, what gcc's bitfield endianness actually is?
In othe...
Ghazi asked 1/12, 2017 at 19:53
4
Solved
If you want to convert uint64_t to a uint8_t[8] (little endian). On a little endian architecture you can just do an ugly reinterpret_cast<> or memcpy(), e.g:
void from_memcpy(const std::uint...
Davidadavidde asked 7/5, 2019 at 12:35
6
Solved
I need a shell script program to print the hexadecimal number from big endian to little endian
For example
Input: my virtual address = 00d66d7e
Output: 7e6dd600
How can I can I create this in a b...
Dupre asked 10/3, 2014 at 9:52
1
Solved
Is it possible to define byte order when converting a numpy array to binary string (with tobytes())?
I would want to force little endianness, but I don't want byte-swapping if it is not necessary....
Chromate asked 11/4, 2019 at 6:57
7
Solved
Im trying to cast a 4 byte array to an ulong in C#. I'm currently using this code:
atomSize = BitConverter.ToUInt32(buffer, 0);
The byte[4] contains this:
0 0 0 32
However, the bytes are Big-E...
Sferics asked 20/7, 2010 at 21:47
4
Solved
Hey everyone, got a quick question that I can't seem to find anything about...
I'm working on a project that requires flag enumerations with a large number of flags (up to 40-ish), and I don't rea...
Gallantry asked 7/5, 2010 at 22:34
4
Solved
I have some low level serialization code that is templated, and I need to know the system's endianness at compiletime obviously (because the templates specializes based on the system's endianness)....
Wherry asked 11/11, 2008 at 6:29
4
Solved
I need help understanding endianness inside CPU registers of x86 processors. I wrote this small assembly program:
section .data
section .bss
section .text
global _start
_start:
nop
mov eax, 0x...
Lucylud asked 21/12, 2010 at 23:1
7
Solved
I need to convert a short value from the host byte order to little endian. If the target was big endian, I could use the htons() function, but alas - it's not.
I guess I could do:
swap(htons(val)...
Corneille asked 9/12, 2009 at 11:40
2
Solved
I have referred many questions in SO on this topic, but couldn't find any solution so far. One natural solution was mentioned here: Determining endianness at compile time.
However, the related prob...
Pluralize asked 29/9, 2016 at 7:5
3
Solved
Is there a BitConverter or other class that supports .Net Core that I can read integers and other values as having Big Endian encoding?
I don't feel good about needing to write a set of helper met...
Vinegary asked 19/5, 2015 at 13:5
1
Solved
I'm working on rather old code atm, and this code tests the endianness of types like short, int, long and long long separately.
Are there systems "still in use" that actually have different endian...
Alter asked 7/8, 2016 at 19:28
2
Solved
In C#, Encoding.UTF32 is UTF-32 little-endian, Encoding.BigEndianUnicode is UTF-16 big-endian, Encoding.Unicode is UTF-16 little-endian. But I can't find any for UTF-32 big-endian.
I'm developing ...
Gotthelf asked 6/10, 2015 at 15:23
3
Solved
Example: 0xAABBCCDD will turn into 0xDDCCBBAA
My program crashes, due to Access Violation exception right in the first XOR operation.
It seems like there's a better naive solution, using shiftin...
Wellgroomed asked 14/10, 2013 at 23:15
7
Solved
I am reading a file by using:
int len = (int)(new File(args[0]).length());
FileInputStream fis =
new FileInputStream(args[0]);
byte buf[] = new byte[len];
fis.read(buf);
As I found here. Is ...
Gnaw asked 11/7, 2012 at 16:30
7
Solved
I have tried searching around but have not been able to find much about binary literals and endianness. Are binary literals little-endian, big-endian or something else (such as matching the target ...
Peephole asked 18/12, 2014 at 16:21
2
Solved
Related to Determine the endianness of a numpy array
Given an array
x = np.arange(3)
I can get the byte order by doing
>>> x.dtype.byteorder
'='
How do I find out if this is big or ...
Denitadenitrate asked 9/4, 2018 at 19:40
3
Solved
Why the output of this program is 4?
#include <iostream>
int main()
{
short A[] = {1, 2, 3, 4, 5, 6};
std::cout << *(short*)((char*)A + 7) << std::endl;
return 0;
}
From my...
Zildjian asked 17/3, 2018 at 17:5
2
Solved
In this question, the following code:
public static void Swap(byte[] data)
{
for (int i = 0; i < data.Length; i += 2)
{
byte b = data[i];
data[i] = data[i + 1];
data[i + 1] = b;
}
}
was...
Clincher asked 25/7, 2012 at 23:19
5
Solved
There's got to be a faster and better way to swap bytes of 16bit words then this.:
public static void Swap(byte[] data)
{
for (int i = 0; i < data.Length; i += 2)
{
byte b = data[i];
data[i...
Tauten asked 23/10, 2009 at 0:50
5
Solved
I have a general conceptual question about endianness and how it affects tcp socket communication with C/C++. Here's an example:
You have two servers that are communicating with tcp sockets and on...
Mcneely asked 13/3, 2014 at 0:30
1
Solved
I am having to work on a web server for work and there are portions of our code written by our chief engineers that I don't understand and am currently trying to decipher. Here is a similar and muc...
Liminal asked 2/3, 2018 at 21:13
1
Solved
I am new to assembly language. I am trying the below code and as you can see the below code.
bits 64
global _start
section .text
_start:
mov rcx, 1234567890
xor rcx, rcx
mov rcx, 'wxyz'
mov ...
Achondrite asked 6/2, 2018 at 14:30
2
Solved
For the following code:
short shortArray [] = { ( 'B' << 8 ) + 'A', ( 'D' << 8 ) + 'C', ( 'F' << 8 ) +
'E', 'G' };
cout << (char*)shortArray;
The output is:
ABCDEFG
...
Tungusic asked 22/1, 2018 at 1:4
4
Solved
With the sort of programs I write (working with raw file data) I often need functions to convert between big and little endian. Usually I write these myself (which is covered by many other posts he...
Subtlety asked 3/4, 2010 at 10:20
© 2022 - 2024 — McMap. All rights reserved.