mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-31 11:28:31 +00:00
Add C version of find_msb()
This patch allows people to build the spice-client on any 32bit/64bit architecture. by Bryan Stillwell <bryan@bokeoa.com>
This commit is contained in:
parent
ae40f270cf
commit
a5cf90922e
@ -60,7 +60,7 @@ found:
|
||||
return r + 1;
|
||||
}
|
||||
|
||||
#else
|
||||
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
||||
static inline int find_msb(unsigned int val)
|
||||
{
|
||||
int ret;
|
||||
@ -73,6 +73,25 @@ static inline int find_msb(unsigned int val)
|
||||
return ret + 1;
|
||||
}
|
||||
|
||||
#else
|
||||
static inline int find_msb(unsigned int val)
|
||||
{
|
||||
signed char index = 31;
|
||||
|
||||
if(val == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
do {
|
||||
if(val & 0x80000000) {
|
||||
break;
|
||||
}
|
||||
val <<= 1;
|
||||
} while(--index >= 0);
|
||||
|
||||
return index+1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static inline int gl_get_to_power_two(unsigned int val)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user