PRCYCoin  2.0.0.7rc1
P2P Digital Currency
glibc_compat.cpp
Go to the documentation of this file.
1 // Copyright (c) 2009-2017 The Bitcoin Core developers
2 // Copyright (c) 2017-2019 The PIVX developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #if defined(HAVE_CONFIG_H)
8 #endif
9 
10 #include <cstddef>
11 #include <cstdint>
12 
13 // Prior to GLIBC_2.14, memcpy was aliased to memmove.
14 extern "C" void* memmove(void* a, const void* b, size_t c);
15 extern "C" void* memcpy(void* a, const void* b, size_t c)
16 {
17  return memmove(a, b, c);
18 }
19 
20 extern "C" void __chk_fail(void) __attribute__((__noreturn__));
21 
22 #if defined(__i386__) || defined(__arm__)
23 
24 extern "C" int64_t __udivmoddi4(uint64_t u, uint64_t v, uint64_t* rp);
25 
26 extern "C" int64_t __wrap___divmoddi4(int64_t u, int64_t v, int64_t* rp)
27 {
28  int32_t c1 = 0, c2 = 0;
29  int64_t uu = u, vv = v;
30  int64_t w;
31  int64_t r;
32 
33  if (uu < 0) {
34  c1 = ~c1, c2 = ~c2, uu = -uu;
35  }
36  if (vv < 0) {
37  c1 = ~c1, vv = -vv;
38  }
39 
40  w = __udivmoddi4(uu, vv, (uint64_t*)&r);
41  if (c1)
42  w = -w;
43  if (c2)
44  r = -r;
45 
46  *rp = r;
47  return w;
48 }
49 #endif
50 
51 extern "C" float log2f_old(float x);
52 #ifdef __i386__
53 __asm(".symver log2f_old,log2f@GLIBC_2.1");
54 #elif defined(__amd64__)
55 __asm(".symver log2f_old,log2f@GLIBC_2.2.5");
56 #elif defined(__arm__)
57 __asm(".symver log2f_old,log2f@GLIBC_2.4");
58 #elif defined(__aarch64__)
59 __asm(".symver log2f_old,log2f@GLIBC_2.17");
60 #elif defined(__riscv)
61 __asm(".symver log2f_old,log2f@GLIBC_2.27");
62 #endif
63 extern "C" float __wrap_log2f(float x)
64 {
65  return log2f_old(x);
66 }
b
void const uint64_t * b
Definition: field_5x52_asm_impl.h:10
memcpy
void * memcpy(void *a, const void *b, size_t c)
Definition: glibc_compat.cpp:15
memmove
void * memmove(void *a, const void *b, size_t c)
__attribute__
void __attribute__((sysv_abi)) secp256k1_fe_mul_inner(const uint64_t *a
r
void const uint64_t uint64_t * r
Definition: field_5x52_asm_impl.h:10
prcycoin-config.h
__wrap_log2f
float __wrap_log2f(float x)
Definition: glibc_compat.cpp:63
log2f_old
float log2f_old(float x)
__chk_fail
void __chk_fail(void) __attribute__((__noreturn__))