Determine word sizes by cross-compiling only


/ Published in: C
Save to your folder(s)

You can find out the word sizes and endianness of a device by compiling the following program with a cross compiler and looking at the executable with the `strings` program or a hex editor. The `TESTIF` macro puts a copy of the statement to test and its truth value into a string which will be present in the exe. This helps if you do not have such a device handy, or if it is cumbersome to access (requires loading firmware etc.).

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.