endianness

Does my AMD-based machine use little endian or big endian?

一个人想着一个人 提交于 2019-11-26 22:46:33
问题 I'm going though a computers system course and I'm trying to establish, for sure , if my AMD based computer is a little endian machine? I believe it is because it would be Intel-compatible. Specifically, my processor is an AMD 64 Athlon x2. I understand that this can matter in C programming. I'm writing C programs and a method I'm using would be affected by this. I'm trying to figure out if I'd get the same results if I ran the program on an Intel based machine (assuming that is little endian

How to get little endian data from big endian in c# using bitConverter.ToInt32 method?

孤街醉人 提交于 2019-11-26 22:44:11
i am making application in c#.In that application i have byte array containing hex values. Here i am getting data as a big endian but i want it as a little endian. Here i am using Bitconverter.toInt32 method for converting that value to integer. But my problem is that before converting value,i have to copy that 4 byte data into temporary array from source byte array and then reverse that temporary byte array. I cant reverse source array because it contains other data also. Because of that my application becomes slow. code Here i have one source array of byte as waveData[].It contains lot much

Java's Virtual Machine's Endianness

余生颓废 提交于 2019-11-26 22:28:36
What endianness does Java use in its virtual machine? I remember reading somewhere that it depends on the physical machine it's running on, and then other places I have read that it is always, I believe, big endian. Which is correct? Multibyte data in the class files are stored big-endian. From The Java Virtual Machine Specification, Java SE 7 Edition , Chapter 4: The class File Format : A class file consists of a stream of 8-bit bytes. All 16-bit, 32-bit, and 64-bit quantities are constructed by reading in two, four, and eight consecutive 8-bit bytes, respectively. Multibyte data items are

PostGIS Geometry saving: “Invalid endian flag value encountered.”

為{幸葍}努か 提交于 2019-11-26 22:02:29
问题 I have a Spring Roo + Hibernate project which takes a JTS well-known text (WKT) String input from the client application, converts it into a JTS Geometry object, and then attempts to write it to the PostGIS database. I had some problems with the JDBC connection and types, but these seem to have been resolved with: @Column(columnDefinition = "Geometry", nullable = true) private Geometry centerPoint; And the conversion does: Geometry geom = new WKTReader(new GeometryFactory(new PrecisionModel()

C# big-endian UCS-2

陌路散爱 提交于 2019-11-26 21:29:57
问题 The project I'm currently working on needs to interface with a client system that we don't make, so we have no control over how data is sent either way. The problem is that were working in C#, which doesn't seem to have any support for UCS-2 and very little support for big-endian. (as far as i can tell) What I would like to know, is if there's anything i looked over in .net, or something that someone else has made and released that we can use. If not I will take a crack at encoding/decoding

How to convert a Byte Array to an Int Array

大憨熊 提交于 2019-11-26 20:46:54
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 it possible to convert byte array buf to an Int Array ? Is converting the Byte Array to Int Array will take significantly more space ? Edit: my file contains millions of ints like, 100000000 200000000 ..... (written using normal int file wirte). I read it to byte buffer. Now I want to wrap it into IntBuffer array. How to do that ? I dont want to convert each byte to int. You've said in the comments that

Is there any “standard” htonl-like function for 64 bits integers in C++?

独自空忆成欢 提交于 2019-11-26 19:48:38
I'm working on an implementation of the memcache protocol which, at some points, uses 64 bits integer values. These values must be stored in "network byte order". I wish there was some uint64_t htonll(uint64_t value) function to do the change, but unfortunately, if it exist, I couldn't find it. So I have 1 or 2 questions: Is there any portable (Windows, Linux, AIX) standard function to do this ? If there is no such function, how would you implement it ? I have in mind a basic implementation but I don't know how to check the endianness at compile-time to make the code portable. So your help is

Is there a way to do a C++ style compile-time assertion to determine machine's endianness?

北战南征 提交于 2019-11-26 19:46:24
问题 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). Right now I have a header with some platform defines, but I'd rather have someway to make assertions about endianness with some templated test (like a static_assert or boost_if). Reason being my code will need to be compiled and ran on a wide range of machines, of many specialized vendor, and

Does Java read integers in little endian or big endian?

社会主义新天地 提交于 2019-11-26 19:46:20
I ask because I am sending a byte stream from a C process to Java. On the C side the 32 bit integer has the LSB is the first byte and MSB is the 4th byte. So my question is: On the Java side when we read the byte as it was sent from the C process, what is endian on the Java side? A follow-up question: If the endian on the Java side is not the same as the one sent, how can I convert between them? Use the network byte order (big endian), which is the same as Java uses anyway. See man htons for the different translators in C. WB Greene I stumbled here via Google and got my answer that Java is big

Does bit-shift depend on endianness?

匆匆过客 提交于 2019-11-26 16:55:46
Suppose I have the number 'numb'=1025 [00000000 00000000 00000100 00000001] represented: On Little-Endian Machine: 00000001 00000100 00000000 00000000 On Big-Endian Machine: 00000000 00000000 00000100 00000001 Now, if I apply Left Shift on 10 bits (i.e.: numb <<= 10), I should have: [A] On Little-Endian Machine: As I noticed in GDB, Little Endian does the Left Shift in 3 steps: [I have shown '3' Steps to better understand the processing only] Treat the no. in Big-Endian Convention: 00000000 00000000 00000100 00000001 Apply Left-Shift: 00000000 00010000 00000100 00000000 Represent the Result