Fix GetLongBit() returns value when _SC_LONG_BIT is not available
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
parent
c6a791bef9
commit
10a3c26c9a
|
@ -4,6 +4,21 @@ package system
|
|||
|
||||
/*
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
|
||||
int GetLongBit() {
|
||||
#ifdef _SC_LONG_BIT
|
||||
int longbits;
|
||||
|
||||
longbits = sysconf(_SC_LONG_BIT);
|
||||
if (longbits < 0) {
|
||||
longbits = (CHAR_BIT * sizeof(long));
|
||||
}
|
||||
return longbits;
|
||||
#else
|
||||
return (CHAR_BIT * sizeof(long));
|
||||
#endif
|
||||
}
|
||||
*/
|
||||
import "C"
|
||||
|
||||
|
@ -12,5 +27,5 @@ func GetClockTicks() int {
|
|||
}
|
||||
|
||||
func GetLongBit() int {
|
||||
return int(C.sysconf(C._SC_LONG_BIT))
|
||||
return int(C.GetLongBit())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue