"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/common/platform.h" between
ponyc-0.33.1.tar.gz and ponyc-0.33.2.tar.gz

About: Pony is an object-oriented, actor-model, capabilities-secure, high performance programming language.

platform.h  (ponyc-0.33.1):platform.h  (ponyc-0.33.2)
skipping to change at line 235 skipping to change at line 235
} }
# endif # endif
#else #else
# define __zu "%zu" # define __zu "%zu"
#endif #endif
/** Standard builtins. /** Standard builtins.
* *
*/ */
#ifdef PLATFORM_IS_CLANG_OR_GCC #ifdef PLATFORM_IS_CLANG_OR_GCC
# define __pony_popcount(X) __builtin_popcount((X)) inline uint32_t __pony_popcount(uint32_t x) {
# define __pony_ffs(X) __builtin_ffs((X)) return (uint32_t)__builtin_popcount(x);
# define __pony_ffsl(X) __builtin_ffsl((X)) }
# define __pony_ctz(X) __builtin_ctz((X))
# define __pony_ctzl(X) __builtin_ctzl((X)) inline uint32_t __pony_ffs(uint32_t x) {
# define __pony_clz(X) __builtin_clz((X)) return (uint32_t)__builtin_ffs((int)x);
# define __pony_clzl(X) __builtin_clzl((X)) }
inline uint32_t __pony_ffsll(uint64_t x) {
return (uint32_t)__builtin_ffsll((long long int)x);
}
inline uint32_t __pony_ctz(uint32_t x) {
return (uint32_t)__builtin_ctz(x);
}
inline uint32_t __pony_clz(uint32_t x) {
return (uint32_t)__builtin_clz(x);
}
inline uint32_t __pony_clzll(uint64_t x) {
return (uint32_t)__builtin_clzll(x);
}
#else #else
# include <intrin.h> # include <intrin.h>
# define __pony_popcount(X) __popcnt((X))
inline uint32_t __pony_ffs(uint32_t x) inline uint32_t __pony_popcount(uint32_t x) {
{ return __popcnt(x);
DWORD i = 0;
unsigned char non_zero = _BitScanForward(&i, x);
return non_zero ? i + 1 : 0;
} }
# ifdef PLATFORM_IS_ILP32 inline uint32_t __pony_ffs(uint32_t x)
inline uint32_t __pony_ffsl(uint32_t x)
{ {
DWORD i = 0; DWORD i = 0;
unsigned char non_zero = _BitScanForward(&i, x); unsigned char non_zero = _BitScanForward(&i, x);
return non_zero ? i + 1 : 0; return non_zero ? i + 1 : 0;
} }
# else
inline uint64_t __pony_ffsl(uint64_t x) inline uint32_t __pony_ffsll(uint64_t x)
{ {
DWORD i = 0; DWORD i = 0;
unsigned char non_zero = _BitScanForward64(&i, x); unsigned char non_zero = _BitScanForward64(&i, x);
return non_zero ? i + 1 : 0; return non_zero ? i + 1 : 0;
} }
# endif
inline uint32_t __pony_ctz(uint32_t x) inline uint32_t __pony_ctz(uint32_t x)
{ {
DWORD i = 0; DWORD i = 0;
_BitScanForward(&i, x); _BitScanForward(&i, x);
return i; return i;
} }
# ifdef PLATFORM_IS_ILP32
inline uint32_t __pony_ctzl(uint32_t x)
{
DWORD i = 0;
_BitScanForward(&i, x);
return i;
}
# else
inline uint64_t __pony_ctzl(uint64_t x)
{
DWORD i = 0;
_BitScanForward64(&i, x);
return i;
}
# endif
inline uint32_t __pony_clz(uint32_t x) inline uint32_t __pony_clz(uint32_t x)
{ {
DWORD i = 0; DWORD i = 0;
_BitScanReverse(&i, x); _BitScanReverse(&i, x);
return 31 - i; return 31 - i;
} }
# ifdef PLATFORM_IS_ILP32 inline uint32_t __pony_clzll(uint64_t x)
inline uint32_t __pony_clzl(uint32_t x)
{
DWORD i = 0;
_BitScanReverse(&i, x);
return 31 - i;
}
# else
inline uint64_t __pony_clzl(uint64_t x)
{ {
DWORD i = 0; DWORD i = 0;
_BitScanReverse64(&i, x); _BitScanReverse64(&i, x);
return 63 - i; return 63 - i;
} }
# endif
#endif #endif
inline uint32_t __pony_ffszu(size_t x) {
#ifdef PLATFORM_IS_ILP32
return __pony_ffs(x);
#else
return __pony_ffsll(x);
#endif
}
inline uint32_t __pony_clzzu(size_t x) {
#ifdef PLATFORM_IS_ILP32
return __pony_clz(x);
#else
return __pony_clzll(x);
#endif
}
/** Static assert /** Static assert
* *
*/ */
#if defined(__clang__) #if defined(__clang__)
# if __has_feature(cxx_static_assert) # if __has_feature(cxx_static_assert)
# define pony_static_assert(c, m) static_assert(c, m) # define pony_static_assert(c, m) static_assert(c, m)
# elif __has_feature(c_static_assert) # elif __has_feature(c_static_assert)
# define pony_static_assert(c, m) _Static_assert(c, m) # define pony_static_assert(c, m) _Static_assert(c, m)
# else # else
 End of changes. 10 change blocks. 
44 lines changed or deleted 46 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)