Revision: 48409
http://brlcad.svn.sourceforge.net/brlcad/?rev=48409&view=rev
Author: brlcad
Date: 2012-01-11 17:41:16 +0000 (Wed, 11 Jan 2012)
Log Message:
-----------
convert from manually trying to test the platform endian to using
bu_byteorder(). this should take care of a coverity DEADCODE issue since it's
not based on sizeof(). (cov cid 161)
Modified Paths:
--------------
brlcad/trunk/src/libbu/convert.c
Modified: brlcad/trunk/src/libbu/convert.c
===================================================================
--- brlcad/trunk/src/libbu/convert.c 2012-01-11 17:38:42 UTC (rev 48408)
+++ brlcad/trunk/src/libbu/convert.c 2012-01-11 17:41:16 UTC (rev 48409)
@@ -262,28 +262,21 @@
/* Run time check: which kind of integers does this machine have? */
if (Endian == END_NOTSET) {
- volatile size_t soli = sizeof(long int);
- unsigned long int testval = 0;
- register int i;
- for (i=0; i<4; i++) {
- ((char *)&testval)[i] = i+1;
- }
+ bu_endian_t end = bu_byteorder();
- if (soli == 8) {
- Endian = END_CRAY; /* is this good enough? */
- if (((testval >> 31) >> 1) == 0x01020304) {
- Endian = END_BIG; /* XXX 64bit */
- } else if (testval == 0x04030201) {
- Endian = END_LITTLE; /* 64 bit */
- } else {
- bu_bomb("bu_cv_optimize: can not tell endian of host.\n");
- }
- } else if (testval == 0x01020304) {
+ switch(end) {
+ case BU_PDP_ENDIAN:
+ Endian = END_CRAY;
+ break;
+ case BU_BIG_ENDIAN:
Endian = END_BIG;
- } else if (testval == 0x04030201) {
+ break;
+ case BU_LITTLE_ENDIAN:
Endian = END_LITTLE;
- } else if (testval == 0x02010403) {
+ break;
+ default:
Endian = END_ILL;
+ break;
}
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits