|
|
|
|
@ -135,12 +135,10 @@ typedef __int64 int64;
|
|
|
|
|
|
|
|
|
|
// Helper functions to represent some assembly instructions.
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus |
|
|
|
|
|
|
|
|
|
#ifdef FAST_MEMCPY |
|
|
|
|
#define qmemcpy memcpy |
|
|
|
|
#else |
|
|
|
|
inline void *qmemcpy(void *dst, const void *src, size_t cnt) |
|
|
|
|
__inline void *qmemcpy(void *dst, const void *src, size_t cnt) |
|
|
|
|
{ |
|
|
|
|
char *out = (char *)dst; |
|
|
|
|
const char *in = (const char *)src; |
|
|
|
|
@ -152,31 +150,15 @@ inline void *qmemcpy(void *dst, const void *src, size_t cnt)
|
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// rotate left
|
|
|
|
|
template <class T> |
|
|
|
|
T __ROL__(T value, int count) |
|
|
|
|
// rotate right
|
|
|
|
|
__inline WORD __ROR2__(WORD value, DWORD count) |
|
|
|
|
{ |
|
|
|
|
const unsigned int nbits = sizeof(T) * 8; |
|
|
|
|
|
|
|
|
|
if (count > 0) { |
|
|
|
|
count %= nbits; |
|
|
|
|
T high = value >> (nbits - count); |
|
|
|
|
if (T(-1) < 0) // signed value
|
|
|
|
|
high &= ~((T(-1) << count)); |
|
|
|
|
value <<= count; |
|
|
|
|
value |= high; |
|
|
|
|
} else { |
|
|
|
|
count = -count % nbits; |
|
|
|
|
T low = value << (nbits - count); |
|
|
|
|
value >>= count; |
|
|
|
|
value |= low; |
|
|
|
|
} |
|
|
|
|
return value; |
|
|
|
|
} |
|
|
|
|
count %= 16; |
|
|
|
|
|
|
|
|
|
inline unsigned short __ROR2__(unsigned short value, int count) { return __ROL__((unsigned short)value, -count); } |
|
|
|
|
inline unsigned int __ROR4__(unsigned int value, int count) { return __ROL__((unsigned int)value, -count); } |
|
|
|
|
return value >> count | value << (16 - count); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus |
|
|
|
|
// sign flag
|
|
|
|
|
template <class T> |
|
|
|
|
char __SETS__(T x) |
|
|
|
|
@ -204,9 +186,6 @@ char __OFSUB__(T x, U y)
|
|
|
|
|
return (sx ^ __SETS__(y2)) & (sx ^ __SETS__(x - y2)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#else |
|
|
|
|
#define qmemcpy memcpy |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#endif /* IDA_GARBAGE */ |
|
|
|
|
|