diff options
author | 2022-09-25 22:28:50 -0400 | |
---|---|---|
committer | 2022-09-25 22:37:29 -0400 | |
commit | 5dc22ca8fd325315c5d24b6ed6a037cc38e86527 (patch) | |
tree | 3b0810f803ef2e9dff52c203510825f7c0b79a9b /src/osd/eivc.h | |
parent | a61cb4cb61c544241712dfb039817e7c7b72e3c0 (diff) |
eminline.h: Additions
- Add mul_16x16 inline function to perform a signed 16x16-bit multiplication with 32-bit result. This was moved from cpu/e132xs to unite it with the analogous 32x32 operations.
- Add rotl_32, rotr_32, rotl_64 and rotr_64 inline functions to perform 32-bit and 64-bit circular shifts in either direction by the specified number of places, modulo 32 or 64. It is anticipated that these will eventually be replaced by standard functions in C++20's <bit> header, and so they have been given similar signatures and semantics (which are also validity-checked).
- Remove LSL, LSR, ROL and ROR macros from cpu/arm and cpu/arm7 to ameliorate unnecessary obfuscation.
Diffstat (limited to 'src/osd/eivc.h')
-rw-r--r-- | src/osd/eivc.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/osd/eivc.h b/src/osd/eivc.h index 2ffd0e7633b..d17fbc2d0c4 100644 --- a/src/osd/eivc.h +++ b/src/osd/eivc.h @@ -14,6 +14,7 @@ #pragma once #include <intrin.h> +#include <stdlib.h> #pragma intrinsic(_BitScanReverse) #ifdef PTR64 #pragma intrinsic(_BitScanReverse64) @@ -91,4 +92,44 @@ __forceinline uint8_t _count_leading_ones_64(uint64_t value) } #endif + +/*------------------------------------------------- + rotl_32 - circularly shift a 32-bit value left + by the specified number of bits (modulo 32) +-------------------------------------------------*/ + +#ifndef rotl_32 +#define rotl_32 _rotl +#endif + + +/*------------------------------------------------- + rotr_32 - circularly shift a 32-bit value right + by the specified number of bits (modulo 32) +-------------------------------------------------*/ + +#ifndef rotr_32 +#define rotr_32 _rotr +#endif + + +/*------------------------------------------------- + rotl_64 - circularly shift a 64-bit value left + by the specified number of bits (modulo 64) +-------------------------------------------------*/ + +#ifndef rotl_64 +#define rotl_64 _rotl64 +#endif + + +/*------------------------------------------------- + rotr_64 - circularly shift a 64-bit value right + by the specified number of bits (modulo 64) +-------------------------------------------------*/ + +#ifndef rotr_64 +#define rotr_64 _rotr64 +#endif + #endif // MAME_OSD_EIVC_H |