zemu 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/zemu/config.rb +312 -0
- data/lib/zemu/instance.rb +179 -0
- data/lib/zemu.rb +172 -0
- data/src/debug.c +118 -0
- data/src/debug.h +30 -0
- data/src/external/Z/API/Z/ABIs/generic/allocator.h +36 -0
- data/src/external/Z/API/Z/ABIs/generic/cipher.h +47 -0
- data/src/external/Z/API/Z/ABIs/generic/data codec.h +33 -0
- data/src/external/Z/API/Z/ABIs/generic/emulation.h +103 -0
- data/src/external/Z/API/Z/ABIs/generic/hash function.h +33 -0
- data/src/external/Z/API/Z/ABIs/generic/module.h +33 -0
- data/src/external/Z/API/Z/ABIs/generic/wave codec.h +40 -0
- data/src/external/Z/API/Z/classes/base/InitializerList.hpp +34 -0
- data/src/external/Z/API/Z/classes/base/OpaqueFunctionPointer.hpp +26 -0
- data/src/external/Z/API/Z/classes/base/OpaqueMemberFunctionPointer.hpp +26 -0
- data/src/external/Z/API/Z/classes/base/Pair.hpp +46 -0
- data/src/external/Z/API/Z/classes/base/Range.hpp +111 -0
- data/src/external/Z/API/Z/classes/base/SizedString.hpp +66 -0
- data/src/external/Z/API/Z/classes/base/Status.hpp +89 -0
- data/src/external/Z/API/Z/classes/base/Symbol.hpp +39 -0
- data/src/external/Z/API/Z/classes/base/Tuple.hpp +111 -0
- data/src/external/Z/API/Z/classes/base/Value2D.hpp +389 -0
- data/src/external/Z/API/Z/classes/base/Value3D.hpp +368 -0
- data/src/external/Z/API/Z/classes/buffering/RingBuffer.hpp +93 -0
- data/src/external/Z/API/Z/classes/buffering/TripleBuffer.hpp +68 -0
- data/src/external/Z/API/Z/classes/functional/Functor.hpp +265 -0
- data/src/external/Z/API/Z/classes/functional/MemberFunction.hpp +98 -0
- data/src/external/Z/API/Z/classes/functional/ObjectMemberFunction.hpp +172 -0
- data/src/external/Z/API/Z/classes/functional/ObjectSelector.hpp +219 -0
- data/src/external/Z/API/Z/classes/functional/Selector.hpp +146 -0
- data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/AABB.hpp +81 -0
- data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/AABR.hpp +685 -0
- data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Box.hpp +219 -0
- data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Circle.hpp +80 -0
- data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Line2D.hpp +93 -0
- data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Line3D.hpp +80 -0
- data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Rectangle.hpp +675 -0
- data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Sphere.hpp +0 -0
- data/src/external/Z/API/Z/classes/memory/Shared.hpp +90 -0
- data/src/external/Z/API/Z/constants/base.h +35 -0
- data/src/external/Z/API/Z/constants/chemical elements.h +6385 -0
- data/src/external/Z/API/Z/constants/numbers.h +963 -0
- data/src/external/Z/API/Z/constants/version.h +15 -0
- data/src/external/Z/API/Z/formats/character set/ASCII.h +158 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP437.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP737.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP775.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP850.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP852.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP855.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP857.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP858.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP860.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP861.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP862.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP863.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP864.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP865.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP866.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP869.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP872.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP874.h +159 -0
- data/src/external/Z/API/Z/formats/character set/Unicode.h +30119 -0
- data/src/external/Z/API/Z/formats/data model/I16LP32.h +19 -0
- data/src/external/Z/API/Z/formats/data model/ILP32.h +19 -0
- data/src/external/Z/API/Z/formats/data model/ILP64.h +19 -0
- data/src/external/Z/API/Z/formats/data model/IP16L32.h +19 -0
- data/src/external/Z/API/Z/formats/data model/LLP64.h +19 -0
- data/src/external/Z/API/Z/formats/data model/LP32.h +19 -0
- data/src/external/Z/API/Z/formats/data model/LP64.h +19 -0
- data/src/external/Z/API/Z/formats/data model/SILP64.h +19 -0
- data/src/external/Z/API/Z/formats/file system/FAT12.h +61 -0
- data/src/external/Z/API/Z/formats/floating-point/IEEE 754.h +141 -0
- data/src/external/Z/API/Z/formats/floating-point/x87.h +74 -0
- data/src/external/Z/API/Z/formats/image/ICNS.h +39 -0
- data/src/external/Z/API/Z/formats/keymap/Mac OS.h +284 -0
- data/src/external/Z/API/Z/formats/keymap/Z.h +141 -0
- data/src/external/Z/API/Z/formats/multimedia/Creative Voice.h +106 -0
- data/src/external/Z/API/Z/formats/multimedia/Microsoft Wave.h +49 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/ACH.h +44 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/FRZ.h +54 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/PRG.h +33 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/SEM.h +46 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/SIT.h +34 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/SNA.h +117 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/SNP.h +37 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/SP.h +62 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/Z80.h +117 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/ZX.h +56 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/ZX82.h +70 -0
- data/src/external/Z/API/Z/formats/storage medium image/NES Game Pak/UNIF.h +26 -0
- data/src/external/Z/API/Z/formats/storage medium image/NES Game Pak/iNES.h +76 -0
- data/src/external/Z/API/Z/formats/storage medium image/audio/TAP.h +25 -0
- data/src/external/Z/API/Z/formats/storage medium image/audio/TZX.h +1185 -0
- data/src/external/Z/API/Z/formats/storage medium image/audio/Warajevo TAP.h +32 -0
- data/src/external/Z/API/Z/formats/storage medium image/floppy disk/FDI.h +45 -0
- data/src/external/Z/API/Z/functions/base/Z2D.h +583 -0
- data/src/external/Z/API/Z/functions/base/Z3D.h +712 -0
- data/src/external/Z/API/Z/functions/base/ZRange.h +137 -0
- data/src/external/Z/API/Z/functions/base/all.h +16 -0
- data/src/external/Z/API/Z/functions/base/casting.hpp +37 -0
- data/src/external/Z/API/Z/functions/base/character.h +38 -0
- data/src/external/Z/API/Z/functions/base/constructors.h +326 -0
- data/src/external/Z/API/Z/functions/base/structure.hpp +26 -0
- data/src/external/Z/API/Z/functions/base/type.hpp +60 -0
- data/src/external/Z/API/Z/functions/base/value.h +1901 -0
- data/src/external/Z/API/Z/functions/base/value.hpp +112 -0
- data/src/external/Z/API/Z/functions/buffering/ZRingBuffer.h +85 -0
- data/src/external/Z/API/Z/functions/buffering/ZTripleBuffer.h +65 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/Z2DLine.h +179 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/Z3DLine.h +168 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZAABB.h +361 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZAABR.h +1081 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZBox.h +340 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZCircle.h +142 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZRectangle.h +1267 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZSphere.h +156 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/all.h +18 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/constructors.h +620 -0
- data/src/external/Z/API/Z/functions/time/date.h +29 -0
- data/src/external/Z/API/Z/hardware/CPU/architecture/6502.h +90 -0
- data/src/external/Z/API/Z/hardware/CPU/architecture/Z80.h +245 -0
- data/src/external/Z/API/Z/hardware/CPU/architecture/i4004.h +37 -0
- data/src/external/Z/API/Z/hardware/PSG/General Instrument/AY-3-891x.h +180 -0
- data/src/external/Z/API/Z/hardware/VDC/Ricoh/RP2C0x.h +625 -0
- data/src/external/Z/API/Z/hardware/bus/AGP.h +24 -0
- data/src/external/Z/API/Z/hardware/bus/USB.h +510 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/Inves Spectrum +.h +47 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/Pentagon.h +13 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/Scorpion.h +13 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum + 128K.h +158 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum +.h +82 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum +2.h +13 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum +2A.h +13 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum +3.h +13 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum.h +109 -0
- data/src/external/Z/API/Z/hardware/machine/model/console/Nintendo Entertainment System/NES-001 (NTSC).h +29 -0
- data/src/external/Z/API/Z/hardware/machine/model/console/Nintendo Entertainment System/NES-001 (PAL).h +29 -0
- data/src/external/Z/API/Z/hardware/machine/platform/computer/ZX Spectrum.h +405 -0
- data/src/external/Z/API/Z/hardware/machine/platform/console/Game Boy.h +49 -0
- data/src/external/Z/API/Z/hardware/machine/platform/console/Nintendo Entertainment System.h +350 -0
- data/src/external/Z/API/Z/hardware/storage medium/ROM cartridge/SNES Game Pak.h +238 -0
- data/src/external/Z/API/Z/inspection/C/completion.h +178 -0
- data/src/external/Z/API/Z/inspection/C/modules/C11.h +41 -0
- data/src/external/Z/API/Z/inspection/C/modules/C18.h +13 -0
- data/src/external/Z/API/Z/inspection/C/modules/C89.h +19 -0
- data/src/external/Z/API/Z/inspection/C/modules/C90.h +13 -0
- data/src/external/Z/API/Z/inspection/C/modules/C94.h +15 -0
- data/src/external/Z/API/Z/inspection/C/modules/C99.h +29 -0
- data/src/external/Z/API/Z/inspection/C/modules/KR C.h +19 -0
- data/src/external/Z/API/Z/inspection/C++/completion.h +512 -0
- data/src/external/Z/API/Z/inspection/C++/modules/C++03.h +15 -0
- data/src/external/Z/API/Z/inspection/C++/modules/C++11.h +80 -0
- data/src/external/Z/API/Z/inspection/C++/modules/C++14.h +26 -0
- data/src/external/Z/API/Z/inspection/C++/modules/C++17.h +55 -0
- data/src/external/Z/API/Z/inspection/C++/modules/C++85.h +11 -0
- data/src/external/Z/API/Z/inspection/C++/modules/C++89.h +13 -0
- data/src/external/Z/API/Z/inspection/C++/modules/C++98.h +17 -0
- data/src/external/Z/API/Z/inspection/C++.h +78 -0
- data/src/external/Z/API/Z/inspection/C.h +79 -0
- data/src/external/Z/API/Z/inspection/CPU/completion.h +56 -0
- data/src/external/Z/API/Z/inspection/CPU/detection.h +714 -0
- data/src/external/Z/API/Z/inspection/CPU/modules/6502.h +25 -0
- data/src/external/Z/API/Z/inspection/CPU/modules/AArch32.h +32 -0
- data/src/external/Z/API/Z/inspection/CPU/modules/AArch64.h +32 -0
- data/src/external/Z/API/Z/inspection/CPU/modules/Z80.h +26 -0
- data/src/external/Z/API/Z/inspection/CPU/modules/x86-32.h +31 -0
- data/src/external/Z/API/Z/inspection/CPU/modules/x86-64.h +312 -0
- data/src/external/Z/API/Z/inspection/CPU.h +209 -0
- data/src/external/Z/API/Z/inspection/OS/completion.h +36 -0
- data/src/external/Z/API/Z/inspection/OS/detection.h +768 -0
- data/src/external/Z/API/Z/inspection/OS/modules/Linux.h +22 -0
- data/src/external/Z/API/Z/inspection/OS/modules/MS-DOS.h +16 -0
- data/src/external/Z/API/Z/inspection/OS/modules/Mac OS X.h +23 -0
- data/src/external/Z/API/Z/inspection/OS/modules/Windows.h +19 -0
- data/src/external/Z/API/Z/inspection/OS/modules/iPhone OS.h +23 -0
- data/src/external/Z/API/Z/inspection/OS.h +236 -0
- data/src/external/Z/API/Z/inspection/Objective-C/completion.h +8 -0
- data/src/external/Z/API/Z/inspection/Objective-C/modules/Objective-C v1.0.h +11 -0
- data/src/external/Z/API/Z/inspection/Objective-C/modules/Objective-C v2.0.h +15 -0
- data/src/external/Z/API/Z/inspection/Objective-C.h +51 -0
- data/src/external/Z/API/Z/inspection/Z.h +19 -0
- data/src/external/Z/API/Z/inspection/build.h +22 -0
- data/src/external/Z/API/Z/inspection/character set.h +66 -0
- data/src/external/Z/API/Z/inspection/compiler/completion.h +2885 -0
- data/src/external/Z/API/Z/inspection/compiler/modules/Apple LLVM.h +26 -0
- data/src/external/Z/API/Z/inspection/compiler/modules/Clang.h +1664 -0
- data/src/external/Z/API/Z/inspection/compiler/modules/GCC.h +1366 -0
- data/src/external/Z/API/Z/inspection/compiler/modules/SCCZ80.h +473 -0
- data/src/external/Z/API/Z/inspection/compiler/modules/Visual C++.h +606 -0
- data/src/external/Z/API/Z/inspection/compiler/modules/cc65.h +529 -0
- data/src/external/Z/API/Z/inspection/compiler/modules/generic.h +13 -0
- data/src/external/Z/API/Z/inspection/compiler/modules/template.h +650 -0
- data/src/external/Z/API/Z/inspection/compiler.h +299 -0
- data/src/external/Z/API/Z/inspection/data model/completion.h +128 -0
- data/src/external/Z/API/Z/inspection/data model/deduction.h +9 -0
- data/src/external/Z/API/Z/inspection/data model/detection.h +45 -0
- data/src/external/Z/API/Z/inspection/data model.h +362 -0
- data/src/external/Z/API/Z/inspection/floating-point/completion.h +50 -0
- data/src/external/Z/API/Z/inspection/floating-point.h +324 -0
- data/src/external/Z/API/Z/inspection/language.h +163 -0
- data/src/external/Z/API/Z/inspection/platform/detection.h +9 -0
- data/src/external/Z/API/Z/inspection/platform.h +29 -0
- data/src/external/Z/API/Z/keys/C++.h +27 -0
- data/src/external/Z/API/Z/keys/C.h +29 -0
- data/src/external/Z/API/Z/keys/CPU.h +80 -0
- data/src/external/Z/API/Z/keys/OS.h +182 -0
- data/src/external/Z/API/Z/keys/Objective-C.h +17 -0
- data/src/external/Z/API/Z/keys/chemistry.h +26 -0
- data/src/external/Z/API/Z/keys/compiler.h +178 -0
- data/src/external/Z/API/Z/keys/data model.h +32 -0
- data/src/external/Z/API/Z/keys/endianness.h +24 -0
- data/src/external/Z/API/Z/keys/language.h +21 -0
- data/src/external/Z/API/Z/keys/layout.h +20 -0
- data/src/external/Z/API/Z/keys/mathematics/geometry.h +29 -0
- data/src/external/Z/API/Z/keys/mathematics/number.h +21 -0
- data/src/external/Z/API/Z/keys/order.h +18 -0
- data/src/external/Z/API/Z/keys/platform.h +87 -0
- data/src/external/Z/API/Z/keys/program.h +39 -0
- data/src/external/Z/API/Z/keys/science/chemical elements.h +200 -0
- data/src/external/Z/API/Z/keys/science/electricity.h +18 -0
- data/src/external/Z/API/Z/keys/science/magnetism.h +19 -0
- data/src/external/Z/API/Z/keys/status.h +69 -0
- data/src/external/Z/API/Z/keys/text.h +27 -0
- data/src/external/Z/API/Z/keys/value.h +88 -0
- data/src/external/Z/API/Z/macros/arguments.h +25 -0
- data/src/external/Z/API/Z/macros/casting.h +22 -0
- data/src/external/Z/API/Z/macros/character.h +159 -0
- data/src/external/Z/API/Z/macros/date.h +14 -0
- data/src/external/Z/API/Z/macros/key.h +20 -0
- data/src/external/Z/API/Z/macros/language.h +126 -0
- data/src/external/Z/API/Z/macros/language.hpp +81 -0
- data/src/external/Z/API/Z/macros/members.h +86 -0
- data/src/external/Z/API/Z/macros/pasting.h +308 -0
- data/src/external/Z/API/Z/macros/pointer.h +33 -0
- data/src/external/Z/API/Z/macros/repetition.h +283 -0
- data/src/external/Z/API/Z/macros/structure.h +104 -0
- data/src/external/Z/API/Z/macros/templating.h +407 -0
- data/src/external/Z/API/Z/macros/tokens.h +14 -0
- data/src/external/Z/API/Z/macros/type enumeration.h +43 -0
- data/src/external/Z/API/Z/macros/type selection.hpp +76 -0
- data/src/external/Z/API/Z/macros/value.h +489 -0
- data/src/external/Z/API/Z/macros/variadic pasting.h +21 -0
- data/src/external/Z/API/Z/macros/variadic selection.h +56 -0
- data/src/external/Z/API/Z/macros/variadic.h +46 -0
- data/src/external/Z/API/Z/macros/version.h +17 -0
- data/src/external/Z/API/Z/network/3/IP.h +36 -0
- data/src/external/Z/API/Z/network/4/TCP.h +24 -0
- data/src/external/Z/API/Z/network/4/UDP.h +26 -0
- data/src/external/Z/API/Z/network/7/ED2K.h +104 -0
- data/src/external/Z/API/Z/network/7/HTTP.h +100 -0
- data/src/external/Z/API/Z/traits/SelectType.hpp +71 -0
- data/src/external/Z/API/Z/traits/TernaryType.hpp +20 -0
- data/src/external/Z/API/Z/traits/Type.hpp +4516 -0
- data/src/external/Z/API/Z/traits/TypeCount.hpp +52 -0
- data/src/external/Z/API/Z/traits/TypeList.hpp +376 -0
- data/src/external/Z/API/Z/traits/base.hpp +19 -0
- data/src/external/Z/API/Z/traits/filtering.hpp +30 -0
- data/src/external/Z/API/Z/traits/mathematics.hpp +48 -0
- data/src/external/Z/API/Z/types/arguments.h +19 -0
- data/src/external/Z/API/Z/types/base.h +1655 -0
- data/src/external/Z/API/Z/types/base.hpp +169 -0
- data/src/external/Z/API/Z/types/buffering.h +27 -0
- data/src/external/Z/API/Z/types/mathematics.h +135 -0
- data/src/external/Z/API/Z/types/time.h +23 -0
- data/src/external/Z/COPYING.LESSER +165 -0
- data/src/external/Z/development/Qt Creator/Z.pro +253 -0
- data/src/external/Z/distribution/CocoaPods/Zeta.podspec +18 -0
- data/src/external/Z/distribution/Gentoo Linux/Zeta-0.1.ebuild +22 -0
- data/src/external/Z/distribution/Gentoo Linux/metadata.xml +8 -0
- data/src/external/Z/distribution/Homebrew/Zeta.rb +11 -0
- data/src/external/z80/API/emulation/CPU/Z80.h +201 -0
- data/src/external/z80/README.md +229 -0
- data/src/external/z80/building/premake4.lua +33 -0
- data/src/external/z80/development/Xcode/Z80.xcodeproj/project.pbxproj +520 -0
- data/src/external/z80/sources/Z80.c +1660 -0
- data/src/interrupt.c +6 -0
- data/src/interrupt.h +3 -0
- data/src/io.c.erb +115 -0
- data/src/io.h.erb +18 -0
- data/src/main.c +69 -0
- data/src/memory.c.erb +43 -0
- data/src/memory.h.erb +9 -0
- metadata +329 -0
@@ -0,0 +1,489 @@
|
|
1
|
+
/* Z Kit - macros/value.h
|
2
|
+
_____ _______________
|
3
|
+
/_ /_/ -_/_ _/ _ |
|
4
|
+
/____/\___/ /__//___/_| Kit
|
5
|
+
Copyright (C) 2006-2018 Manuel Sainz de Baranda y Goñi.
|
6
|
+
Released under the terms of the GNU Lesser General Public License v3. */
|
7
|
+
|
8
|
+
#ifndef _Z_macros_value_H_
|
9
|
+
#define _Z_macros_value_H_
|
10
|
+
|
11
|
+
#include <Z/types/base.h>
|
12
|
+
|
13
|
+
/* MARK: - Basics */
|
14
|
+
|
15
|
+
#define Z_MAXIMUM(a, b) ((a) > (b) ? (a) : (b))
|
16
|
+
#define Z_MINIMUM(a, b) ((a) < (b) ? (a) : (b))
|
17
|
+
|
18
|
+
#define Z_ABSOLUTE( value) ((a) < 0 ? -(a) : (a))
|
19
|
+
#define Z_IS_POWER_OF_2(value) !((value) & ((value) - 1))
|
20
|
+
|
21
|
+
#define Z_NEXT_MULTIPLE( value, base) ((value) + (base) - ((value) % (base)))
|
22
|
+
#define Z_PREVIOUS_MULTIPLE(value, base) ((((value) - 1) / (base)) * (base))
|
23
|
+
|
24
|
+
/* MARK: - Masked bounded addition/subtraction */
|
25
|
+
|
26
|
+
#define Z_MBA(value, delta, mask) \
|
27
|
+
(((value) & (mask)) + ((delta) & (mask)) > (mask) \
|
28
|
+
? (mask) : ((value) & (mask)) + ((delta) & (mask)))
|
29
|
+
|
30
|
+
#define Z_MBS(value, delta, mask) \
|
31
|
+
(((value) & (mask)) - ((delta) & (mask)) > (mask) \
|
32
|
+
? 0 : ((value) & (mask)) - ((delta) & (mask)))
|
33
|
+
|
34
|
+
/* MARK: - 8-bit operations */
|
35
|
+
|
36
|
+
#define Z_8BIT_REVERSE_IN_1BIT(value) \
|
37
|
+
( ((value) << 7) | ((value) >> 7) | \
|
38
|
+
(((value) << 5) & (1 << 6)) | (((value) >> 5) & (1 << 1)) | \
|
39
|
+
(((value) << 3) & (1 << 5)) | (((value) >> 3) & (1 << 2)) | \
|
40
|
+
(((value) << 1) & (1 << 4)) | (((value) >> 1) & (1 << 3)))
|
41
|
+
|
42
|
+
#define Z_8BIT_REVERSE_IN_2BIT(value) \
|
43
|
+
( ((value) << 6) | ((value) >> 6) | \
|
44
|
+
(((value) << 2) & (3 << 4)) | (((value) >> 2) & (3 << 2)))
|
45
|
+
|
46
|
+
#define Z_8BIT_REVERSE_IN_4BIT(value) \
|
47
|
+
(((value) << 4) | ((value) >> 4))
|
48
|
+
|
49
|
+
#define Z_8BIT_ROTATE_LEFT(value, rotation) \
|
50
|
+
(((value) << (rotation)) | ((value) >> (8 - (rotation))))
|
51
|
+
|
52
|
+
#define Z_8BIT_ROTATE_RIGHT(value, rotation) \
|
53
|
+
(((value) >> (rotation)) | ((value) << (8 - (rotation))))
|
54
|
+
|
55
|
+
#define Z_8BIT_BIG_ENDIAN( value) (value)
|
56
|
+
#define Z_8BIT_LITTLE_ENDIAN(value) (value)
|
57
|
+
|
58
|
+
/* MARK: - 16-bit operations */
|
59
|
+
|
60
|
+
#define Z_8BIT_16BIT_MIRROR(value) \
|
61
|
+
(((zuint16)(value)) * Z_UINT16(0x0101))
|
62
|
+
|
63
|
+
#define Z_16BIT_REVERSE_IN_1BIT(value) \
|
64
|
+
( ((value) << 15) | ((value) >> 15) | \
|
65
|
+
(((value) << 13) & (1 << 14)) | (((value) >> 13) & (1 << 1)) | \
|
66
|
+
(((value) << 11) & (1 << 13)) | (((value) >> 11) & (1 << 2)) | \
|
67
|
+
(((value) << 9) & (1 << 12)) | (((value) >> 9) & (1 << 3)) | \
|
68
|
+
(((value) << 7) & (1 << 11)) | (((value) >> 7) & (1 << 4)) | \
|
69
|
+
(((value) << 5) & (1 << 10)) | (((value) >> 5) & (1 << 5)) | \
|
70
|
+
(((value) << 3) & (1 << 9)) | (((value) >> 3) & (1 << 6)) | \
|
71
|
+
(((value) << 1) & (1 << 8)) | (((value) >> 1) & (1 << 7)))
|
72
|
+
|
73
|
+
#define Z_16BIT_REVERSE_IN_2BIT(value) \
|
74
|
+
( ((value) << 14) | ((value) >> 14) | \
|
75
|
+
(((value) << 10) & (3 << 12)) | (((value) >> 10) & (3 << 2)) | \
|
76
|
+
(((value) << 6) & (3 << 10)) | (((value) >> 6) & (3 << 4)) | \
|
77
|
+
(((value) << 2) & (3 << 8)) | (((value) >> 2) & (3 << 6)))
|
78
|
+
|
79
|
+
#define Z_16BIT_REVERSE_IN_4BIT(value) \
|
80
|
+
( ((value) << 12) | ((value) >> 12) | \
|
81
|
+
(((value) << 4) & (15 << 8)) | (((value) >> 4) & (15 << 4)))
|
82
|
+
|
83
|
+
#define Z_16BIT_REVERSE_IN_8BIT(value) \
|
84
|
+
(((value) << 8) | ((value) >> 8))
|
85
|
+
|
86
|
+
#define Z_16BIT_ROTATE_LEFT(value, rotation) \
|
87
|
+
(((value) << (rotation)) | ((value) >> (16 - (rotation))))
|
88
|
+
|
89
|
+
#define Z_16BIT_ROTATE_RIGHT(value, rotation) \
|
90
|
+
(((value) >> (rotation)) | ((value) << (16 - (rotation))))
|
91
|
+
|
92
|
+
#if Z_UINT16_ENDIANNESS == Z_ENDIANNESS_BIG
|
93
|
+
# define Z_16BIT_BIG_ENDIAN Z_SAME
|
94
|
+
# define Z_16BIT_LITTLE_ENDIAN Z_16BIT_REVERSE_IN_8BIT
|
95
|
+
|
96
|
+
#elif Z_UINT16_ENDIANNESS == Z_ENDIANNESS_LITTLE
|
97
|
+
# define Z_16BIT_BIG_ENDIAN Z_16BIT_REVERSE_IN_8BIT
|
98
|
+
# define Z_16BIT_LITTLE_ENDIAN Z_SAME
|
99
|
+
#endif
|
100
|
+
|
101
|
+
/* MARK: - 32-bit operations */
|
102
|
+
|
103
|
+
#define Z_8BIT_32BIT_MIRROR(value) \
|
104
|
+
(((zuint32)(value)) * Z_UINT32(0x01010101))
|
105
|
+
|
106
|
+
#define Z_16BIT_32BIT_MIRROR(value) \
|
107
|
+
(((zuint32)(value)) * Z_UINT32(0x00010001))
|
108
|
+
|
109
|
+
#define Z_32BIT_REVERSE_IN_1BIT(value) \
|
110
|
+
( ((value) << 31) | ((value) >> 31) | \
|
111
|
+
(((value) << 29) & ((zuint32)1 << 30)) | (((value) >> 29) & ((zuint32)1 << 1)) | \
|
112
|
+
(((value) << 27) & ((zuint32)1 << 29)) | (((value) >> 27) & ((zuint32)1 << 2)) | \
|
113
|
+
(((value) << 25) & ((zuint32)1 << 28)) | (((value) >> 25) & ((zuint32)1 << 3)) | \
|
114
|
+
(((value) << 23) & ((zuint32)1 << 27)) | (((value) >> 23) & ((zuint32)1 << 4)) | \
|
115
|
+
(((value) << 21) & ((zuint32)1 << 26)) | (((value) >> 21) & ((zuint32)1 << 5)) | \
|
116
|
+
(((value) << 19) & ((zuint32)1 << 25)) | (((value) >> 19) & ((zuint32)1 << 6)) | \
|
117
|
+
(((value) << 17) & ((zuint32)1 << 24)) | (((value) >> 17) & ((zuint32)1 << 7)) | \
|
118
|
+
(((value) << 15) & ((zuint32)1 << 23)) | (((value) >> 15) & ((zuint32)1 << 8)) | \
|
119
|
+
(((value) << 13) & ((zuint32)1 << 22)) | (((value) >> 13) & ((zuint32)1 << 9)) | \
|
120
|
+
(((value) << 11) & ((zuint32)1 << 21)) | (((value) >> 11) & ((zuint32)1 << 10)) | \
|
121
|
+
(((value) << 9) & ((zuint32)1 << 20)) | (((value) >> 9) & ((zuint32)1 << 11)) | \
|
122
|
+
(((value) << 7) & ((zuint32)1 << 19)) | (((value) >> 7) & ((zuint32)1 << 12)) | \
|
123
|
+
(((value) << 5) & ((zuint32)1 << 18)) | (((value) >> 5) & ((zuint32)1 << 13)) | \
|
124
|
+
(((value) << 3) & ((zuint32)1 << 17)) | (((value) >> 3) & ((zuint32)1 << 14)) | \
|
125
|
+
(((value) << 1) & ((zuint32)1 << 16)) | (((value) >> 1) & ((zuint32)1 << 15)))
|
126
|
+
|
127
|
+
#define Z_32BIT_REVERSE_IN_2BIT(value) \
|
128
|
+
( ((value) << 30) | ((value) >> 30) | \
|
129
|
+
(((value) << 26) & ((zuint32)3 << 28)) | (((value) >> 26) & ((zuint32)3 << 2)) | \
|
130
|
+
(((value) << 22) & ((zuint32)3 << 26)) | (((value) >> 22) & ((zuint32)3 << 4)) | \
|
131
|
+
(((value) << 18) & ((zuint32)3 << 24)) | (((value) >> 18) & ((zuint32)3 << 6)) | \
|
132
|
+
(((value) << 14) & ((zuint32)3 << 22)) | (((value) >> 14) & ((zuint32)3 << 8)) | \
|
133
|
+
(((value) << 10) & ((zuint32)3 << 20)) | (((value) >> 10) & ((zuint32)3 << 10)) | \
|
134
|
+
(((value) << 6) & ((zuint32)3 << 18)) | (((value) >> 6) & ((zuint32)3 << 12)) | \
|
135
|
+
(((value) << 2) & ((zuint32)3 << 16)) | (((value) >> 2) & ((zuint32)3 << 14)))
|
136
|
+
|
137
|
+
#define Z_32BIT_REVERSE_IN_4BIT(value) \
|
138
|
+
( ((value) << 28) | ((value) >> 28) | \
|
139
|
+
(((value) << 20) & ((zuint32)15 << 24)) | (((value) >> 20) & ((zuint32)15 << 4)) | \
|
140
|
+
(((value) << 12) & ((zuint32)15 << 20)) | (((value) >> 12) & ((zuint32)15 << 8)) | \
|
141
|
+
(((value) << 4) & ((zuint32)15 << 16)) | (((value) >> 4) & ((zuint32)15 << 12)))
|
142
|
+
|
143
|
+
#define Z_32BIT_REVERSE_IN_8BIT(value) \
|
144
|
+
( ((value) << 24) | ((value) >> 24) | \
|
145
|
+
(((value) << 8) & ((zuint32)255 << 16)) | (((value) >> 8) & ((zuint32)255 << 8)))
|
146
|
+
|
147
|
+
#define Z_32BIT_REVERSE_IN_16BIT(value) \
|
148
|
+
(((value) << 16) | ((value) >> 16))
|
149
|
+
|
150
|
+
#define Z_32BIT_ROTATE_LEFT(value, rotation) \
|
151
|
+
(((value) << (rotation)) | ((value) >> (32 - (rotation))))
|
152
|
+
|
153
|
+
#define Z_32BIT_ROTATE_RIGHT(value, rotation) \
|
154
|
+
(((value) >> (rotation)) | ((value) << (32 - (rotation))))
|
155
|
+
|
156
|
+
#if Z_UINT32_ENDIANNESS == Z_ENDIANNESS_BIG
|
157
|
+
# define Z_32BIT_BIG_ENDIAN Z_SAME
|
158
|
+
# define Z_32BIT_LITTLE_ENDIAN Z_32BIT_REVERSE_IN_8BIT
|
159
|
+
|
160
|
+
#elif Z_UINT32_ENDIANNESS == Z_ENDIANNESS_LITTLE
|
161
|
+
# define Z_32BIT_BIG_ENDIAN Z_32BIT_REVERSE_IN_8BIT
|
162
|
+
# define Z_32BIT_LITTLE_ENDIAN Z_SAME
|
163
|
+
#endif
|
164
|
+
|
165
|
+
/* MARK: - 64-bit operations */
|
166
|
+
|
167
|
+
#ifdef Z_UINT64
|
168
|
+
|
169
|
+
# define Z_8BIT_64BIT_MIRROR(value) \
|
170
|
+
(((zuint64)(value)) * Z_UINT64(0x0101010101010101))
|
171
|
+
|
172
|
+
# define Z_16BIT_64BIT_MIRROR(value) \
|
173
|
+
(((zuint64)(value)) * Z_UINT64(0x0001000100010001))
|
174
|
+
|
175
|
+
# define Z_32BIT_64BIT_MIRROR(value) \
|
176
|
+
(((zuint64)(value)) * Z_UINT64(0x0000000100000001))
|
177
|
+
|
178
|
+
# define Z_64BIT_REVERSE_IN_1BIT(value) \
|
179
|
+
( ((value) << 63) | ((value) >> 63) | \
|
180
|
+
(((value) << 61) & ((zuint64)1 << 62)) | (((value) >> 61) & ((zuint64)1 << 1)) | \
|
181
|
+
(((value) << 59) & ((zuint64)1 << 61)) | (((value) >> 59) & ((zuint64)1 << 2)) | \
|
182
|
+
(((value) << 57) & ((zuint64)1 << 60)) | (((value) >> 57) & ((zuint64)1 << 3)) | \
|
183
|
+
(((value) << 55) & ((zuint64)1 << 59)) | (((value) >> 55) & ((zuint64)1 << 4)) | \
|
184
|
+
(((value) << 53) & ((zuint64)1 << 58)) | (((value) >> 53) & ((zuint64)1 << 5)) | \
|
185
|
+
(((value) << 51) & ((zuint64)1 << 57)) | (((value) >> 51) & ((zuint64)1 << 6)) | \
|
186
|
+
(((value) << 49) & ((zuint64)1 << 56)) | (((value) >> 49) & ((zuint64)1 << 7)) | \
|
187
|
+
(((value) << 47) & ((zuint64)1 << 55)) | (((value) >> 47) & ((zuint64)1 << 8)) | \
|
188
|
+
(((value) << 45) & ((zuint64)1 << 54)) | (((value) >> 45) & ((zuint64)1 << 9)) | \
|
189
|
+
(((value) << 43) & ((zuint64)1 << 53)) | (((value) >> 43) & ((zuint64)1 << 10)) | \
|
190
|
+
(((value) << 41) & ((zuint64)1 << 52)) | (((value) >> 41) & ((zuint64)1 << 11)) | \
|
191
|
+
(((value) << 39) & ((zuint64)1 << 51)) | (((value) >> 39) & ((zuint64)1 << 12)) | \
|
192
|
+
(((value) << 37) & ((zuint64)1 << 50)) | (((value) >> 37) & ((zuint64)1 << 13)) | \
|
193
|
+
(((value) << 35) & ((zuint64)1 << 49)) | (((value) >> 35) & ((zuint64)1 << 14)) | \
|
194
|
+
(((value) << 33) & ((zuint64)1 << 48)) | (((value) >> 33) & ((zuint64)1 << 15)) | \
|
195
|
+
(((value) << 31) & ((zuint64)1 << 47)) | (((value) >> 31) & ((zuint64)1 << 16)) | \
|
196
|
+
(((value) << 29) & ((zuint64)1 << 46)) | (((value) >> 29) & ((zuint64)1 << 17)) | \
|
197
|
+
(((value) << 27) & ((zuint64)1 << 45)) | (((value) >> 27) & ((zuint64)1 << 18)) | \
|
198
|
+
(((value) << 25) & ((zuint64)1 << 44)) | (((value) >> 25) & ((zuint64)1 << 19)) | \
|
199
|
+
(((value) << 23) & ((zuint64)1 << 43)) | (((value) >> 23) & ((zuint64)1 << 20)) | \
|
200
|
+
(((value) << 21) & ((zuint64)1 << 42)) | (((value) >> 21) & ((zuint64)1 << 21)) | \
|
201
|
+
(((value) << 19) & ((zuint64)1 << 41)) | (((value) >> 19) & ((zuint64)1 << 22)) | \
|
202
|
+
(((value) << 17) & ((zuint64)1 << 40)) | (((value) >> 17) & ((zuint64)1 << 23)) | \
|
203
|
+
(((value) << 15) & ((zuint64)1 << 39)) | (((value) >> 15) & ((zuint64)1 << 24)) | \
|
204
|
+
(((value) << 13) & ((zuint64)1 << 38)) | (((value) >> 13) & ((zuint64)1 << 25)) | \
|
205
|
+
(((value) << 11) & ((zuint64)1 << 37)) | (((value) >> 11) & ((zuint64)1 << 26)) | \
|
206
|
+
(((value) << 9) & ((zuint64)1 << 36)) | (((value) >> 9) & ((zuint64)1 << 27)) | \
|
207
|
+
(((value) << 7) & ((zuint64)1 << 35)) | (((value) >> 7) & ((zuint64)1 << 28)) | \
|
208
|
+
(((value) << 5) & ((zuint64)1 << 34)) | (((value) >> 5) & ((zuint64)1 << 29)) | \
|
209
|
+
(((value) << 3) & ((zuint64)1 << 33)) | (((value) >> 3) & ((zuint64)1 << 30)) | \
|
210
|
+
(((value) << 1) & ((zuint64)1 << 32)) | (((value) >> 1) & ((zuint64)1 << 31)))
|
211
|
+
|
212
|
+
# define Z_64BIT_REVERSE_IN_2BIT(value) \
|
213
|
+
( ((value) << 62) | ((value) >> 62) | \
|
214
|
+
(((value) << 58) & ((zuint64)3 << 60)) | (((value) >> 58) & ((zuint64)3 << 2)) | \
|
215
|
+
(((value) << 54) & ((zuint64)3 << 58)) | (((value) >> 54) & ((zuint64)3 << 4)) | \
|
216
|
+
(((value) << 50) & ((zuint64)3 << 56)) | (((value) >> 50) & ((zuint64)3 << 6)) | \
|
217
|
+
(((value) << 46) & ((zuint64)3 << 54)) | (((value) >> 46) & ((zuint64)3 << 8)) | \
|
218
|
+
(((value) << 42) & ((zuint64)3 << 52)) | (((value) >> 42) & ((zuint64)3 << 10)) | \
|
219
|
+
(((value) << 38) & ((zuint64)3 << 50)) | (((value) >> 38) & ((zuint64)3 << 12)) | \
|
220
|
+
(((value) << 34) & ((zuint64)3 << 48)) | (((value) >> 34) & ((zuint64)3 << 14)) | \
|
221
|
+
(((value) << 30) & ((zuint64)3 << 46)) | (((value) >> 30) & ((zuint64)3 << 16)) | \
|
222
|
+
(((value) << 26) & ((zuint64)3 << 44)) | (((value) >> 26) & ((zuint64)3 << 18)) | \
|
223
|
+
(((value) << 22) & ((zuint64)3 << 42)) | (((value) >> 22) & ((zuint64)3 << 20)) | \
|
224
|
+
(((value) << 18) & ((zuint64)3 << 40)) | (((value) >> 18) & ((zuint64)3 << 22)) | \
|
225
|
+
(((value) << 14) & ((zuint64)3 << 38)) | (((value) >> 14) & ((zuint64)3 << 24)) | \
|
226
|
+
(((value) << 10) & ((zuint64)3 << 36)) | (((value) >> 10) & ((zuint64)3 << 26)) | \
|
227
|
+
(((value) << 6) & ((zuint64)3 << 34)) | (((value) >> 6) & ((zuint64)3 << 28)) | \
|
228
|
+
(((value) << 2) & ((zuint64)3 << 32)) | (((value) >> 2) & ((zuint64)3 << 30)))
|
229
|
+
|
230
|
+
# define Z_64BIT_REVERSE_IN_4BIT(value) \
|
231
|
+
( ((value) << 60) | ((value) >> 60) | \
|
232
|
+
(((value) << 52) & ((zuint64)15 << 56)) | (((value) >> 52) & ((zuint64)15 << 4)) | \
|
233
|
+
(((value) << 44) & ((zuint64)15 << 52)) | (((value) >> 44) & ((zuint64)15 << 8)) | \
|
234
|
+
(((value) << 36) & ((zuint64)15 << 48)) | (((value) >> 36) & ((zuint64)15 << 12)) | \
|
235
|
+
(((value) << 28) & ((zuint64)15 << 44)) | (((value) >> 28) & ((zuint64)15 << 16)) | \
|
236
|
+
(((value) << 20) & ((zuint64)15 << 40)) | (((value) >> 20) & ((zuint64)15 << 20)) | \
|
237
|
+
(((value) << 12) & ((zuint64)15 << 36)) | (((value) >> 12) & ((zuint64)15 << 24)) | \
|
238
|
+
(((value) << 4) & ((zuint64)15 << 32)) | (((value) >> 4) & ((zuint64)15 << 28)))
|
239
|
+
|
240
|
+
# define Z_64BIT_REVERSE_IN_8BIT(value) \
|
241
|
+
( ((value) << 56) | ((value) >> 56) | \
|
242
|
+
(((value) << 40) & ((zuint64)255 << 48)) | (((value) >> 40) & ((zuint64)255 << 8)) | \
|
243
|
+
(((value) << 24) & ((zuint64)255 << 40)) | (((value) >> 24) & ((zuint64)255 << 16)) | \
|
244
|
+
(((value) << 8) & ((zuint64)255 << 32)) | (((value) >> 8) & ((zuint64)255 << 24)))
|
245
|
+
|
246
|
+
# define Z_64BIT_REVERSE_IN_16BIT(value) \
|
247
|
+
( ((value) << 48) | ((value) >> 48) | \
|
248
|
+
(((value) << 16) & ((zuint64)65535 << 32)) | (((value) >> 16) & ((zuint64)65535 << 16)))
|
249
|
+
|
250
|
+
# define Z_64BIT_REVERSE_IN_32BIT(value) \
|
251
|
+
(((value) << 32) | ((value) >> 32))
|
252
|
+
|
253
|
+
# define Z_64BIT_ROTATE_LEFT(value, rotation) \
|
254
|
+
(((value) << (rotation)) | ((value) >> (64 - (rotation))))
|
255
|
+
|
256
|
+
# define Z_64BIT_ROTATE_RIGHT(value, rotation) \
|
257
|
+
(((value) >> (rotation)) | ((value) << (64 - (rotation))))
|
258
|
+
|
259
|
+
# if Z_UINT64_ENDIANNESS == Z_ENDIANNESS_BIG
|
260
|
+
# define Z_64BIT_BIG_ENDIAN Z_SAME
|
261
|
+
# define Z_64BIT_LITTLE_ENDIAN Z_64BIT_REVERSE_IN_8BIT
|
262
|
+
|
263
|
+
# elif Z_UINT64_ENDIANNESS == Z_ENDIANNESS_LITTLE
|
264
|
+
# define Z_64BIT_BIG_ENDIAN Z_64BIT_REVERSE_IN_8BIT
|
265
|
+
# define Z_64BIT_LITTLE_ENDIAN Z_SAME
|
266
|
+
# endif
|
267
|
+
|
268
|
+
#endif
|
269
|
+
|
270
|
+
/* MARK: - 128-bit operations */
|
271
|
+
|
272
|
+
#ifdef Z_UINT128
|
273
|
+
|
274
|
+
# if Z_DATA_MODEL_HAS_LITERAL(UINT128) || Z_DATA_MODEL_HAS_LITERAL(SINT128)
|
275
|
+
|
276
|
+
# define Z_8BIT_128BIT_MIRROR(value) \
|
277
|
+
(((zuint128)(value)) * Z_UINT128(0x01010101010101010101010101010101))
|
278
|
+
|
279
|
+
# define Z_16BIT_128BIT_MIRROR(value) \
|
280
|
+
(((zuint128)(value)) * Z_UINT128(0x00010001000100010001000100010001))
|
281
|
+
|
282
|
+
# define Z_32BIT_128BIT_MIRROR(value) \
|
283
|
+
(((zuint128)(value)) * Z_UINT128(0x00000001000000010000000100000001))
|
284
|
+
|
285
|
+
# define Z_64BIT_128BIT_MIRROR(value) \
|
286
|
+
(((zuint128)(value)) * Z_UINT128(0x00000000000000010000000000000001))
|
287
|
+
|
288
|
+
# else
|
289
|
+
|
290
|
+
# define Z_8BIT_128BIT_MIRROR(value) \
|
291
|
+
(((zuint128)(value)) * ((zuint128)0x0101010101010101 | ((zuint128)0101010101010101 << 64)))
|
292
|
+
|
293
|
+
# define Z_16BIT_128BIT_MIRROR(value) \
|
294
|
+
(((zuint128)(value)) * ((zuint128)0x0001000100010001 | ((zuint128)0001000100010001 << 64)))
|
295
|
+
|
296
|
+
# define Z_32BIT_128BIT_MIRROR(value) \
|
297
|
+
(((zuint128)(value)) * ((zuint128)0x0000000100000001 | ((zuint128)0000000100000001 << 64)))
|
298
|
+
|
299
|
+
# define Z_64BIT_128BIT_MIRROR(value) \
|
300
|
+
(((zuint128)(value)) * ((zuint128)0x0000000000000001 | ((zuint128)0000000000000001 << 64)))
|
301
|
+
|
302
|
+
# endif
|
303
|
+
|
304
|
+
# define Z_128BIT_REVERSE_IN_1BIT(value) \
|
305
|
+
( ((value) << 127) | ((value) >> 127) | \
|
306
|
+
(((value) << 125) & ((zuint128)1 << 126)) | (((value) >> 125) & ((zuint128)1 << 1)) | \
|
307
|
+
(((value) << 123) & ((zuint128)1 << 125)) | (((value) >> 123) & ((zuint128)1 << 2)) | \
|
308
|
+
(((value) << 121) & ((zuint128)1 << 124)) | (((value) >> 121) & ((zuint128)1 << 3)) | \
|
309
|
+
(((value) << 119) & ((zuint128)1 << 123)) | (((value) >> 119) & ((zuint128)1 << 4)) | \
|
310
|
+
(((value) << 117) & ((zuint128)1 << 122)) | (((value) >> 117) & ((zuint128)1 << 5)) | \
|
311
|
+
(((value) << 115) & ((zuint128)1 << 121)) | (((value) >> 115) & ((zuint128)1 << 6)) | \
|
312
|
+
(((value) << 113) & ((zuint128)1 << 120)) | (((value) >> 113) & ((zuint128)1 << 7)) | \
|
313
|
+
(((value) << 111) & ((zuint128)1 << 119)) | (((value) >> 111) & ((zuint128)1 << 8)) | \
|
314
|
+
(((value) << 109) & ((zuint128)1 << 118)) | (((value) >> 109) & ((zuint128)1 << 9)) | \
|
315
|
+
(((value) << 107) & ((zuint128)1 << 117)) | (((value) >> 107) & ((zuint128)1 << 10)) | \
|
316
|
+
(((value) << 105) & ((zuint128)1 << 116)) | (((value) >> 105) & ((zuint128)1 << 11)) | \
|
317
|
+
(((value) << 103) & ((zuint128)1 << 115)) | (((value) >> 103) & ((zuint128)1 << 12)) | \
|
318
|
+
(((value) << 101) & ((zuint128)1 << 114)) | (((value) >> 101) & ((zuint128)1 << 13)) | \
|
319
|
+
(((value) << 99) & ((zuint128)1 << 113)) | (((value) >> 99) & ((zuint128)1 << 14)) | \
|
320
|
+
(((value) << 97) & ((zuint128)1 << 112)) | (((value) >> 97) & ((zuint128)1 << 15)) | \
|
321
|
+
(((value) << 95) & ((zuint128)1 << 111)) | (((value) >> 95) & ((zuint128)1 << 16)) | \
|
322
|
+
(((value) << 93) & ((zuint128)1 << 110)) | (((value) >> 93) & ((zuint128)1 << 17)) | \
|
323
|
+
(((value) << 91) & ((zuint128)1 << 109)) | (((value) >> 91) & ((zuint128)1 << 18)) | \
|
324
|
+
(((value) << 89) & ((zuint128)1 << 108)) | (((value) >> 89) & ((zuint128)1 << 19)) | \
|
325
|
+
(((value) << 87) & ((zuint128)1 << 107)) | (((value) >> 87) & ((zuint128)1 << 20)) | \
|
326
|
+
(((value) << 85) & ((zuint128)1 << 106)) | (((value) >> 85) & ((zuint128)1 << 21)) | \
|
327
|
+
(((value) << 83) & ((zuint128)1 << 105)) | (((value) >> 83) & ((zuint128)1 << 22)) | \
|
328
|
+
(((value) << 81) & ((zuint128)1 << 104)) | (((value) >> 81) & ((zuint128)1 << 23)) | \
|
329
|
+
(((value) << 79) & ((zuint128)1 << 103)) | (((value) >> 79) & ((zuint128)1 << 24)) | \
|
330
|
+
(((value) << 77) & ((zuint128)1 << 102)) | (((value) >> 77) & ((zuint128)1 << 25)) | \
|
331
|
+
(((value) << 75) & ((zuint128)1 << 101)) | (((value) >> 75) & ((zuint128)1 << 26)) | \
|
332
|
+
(((value) << 73) & ((zuint128)1 << 100)) | (((value) >> 73) & ((zuint128)1 << 27)) | \
|
333
|
+
(((value) << 71) & ((zuint128)1 << 99)) | (((value) >> 71) & ((zuint128)1 << 28)) | \
|
334
|
+
(((value) << 69) & ((zuint128)1 << 98)) | (((value) >> 69) & ((zuint128)1 << 29)) | \
|
335
|
+
(((value) << 67) & ((zuint128)1 << 97)) | (((value) >> 67) & ((zuint128)1 << 30)) | \
|
336
|
+
(((value) << 65) & ((zuint128)1 << 96)) | (((value) >> 65) & ((zuint128)1 << 31)) | \
|
337
|
+
(((value) << 63) & ((zuint128)1 << 95)) | (((value) >> 63) & ((zuint128)1 << 32)) | \
|
338
|
+
(((value) << 61) & ((zuint128)1 << 94)) | (((value) >> 61) & ((zuint128)1 << 33)) | \
|
339
|
+
(((value) << 59) & ((zuint128)1 << 93)) | (((value) >> 59) & ((zuint128)1 << 34)) | \
|
340
|
+
(((value) << 57) & ((zuint128)1 << 92)) | (((value) >> 57) & ((zuint128)1 << 35)) | \
|
341
|
+
(((value) << 55) & ((zuint128)1 << 91)) | (((value) >> 55) & ((zuint128)1 << 36)) | \
|
342
|
+
(((value) << 53) & ((zuint128)1 << 90)) | (((value) >> 53) & ((zuint128)1 << 37)) | \
|
343
|
+
(((value) << 51) & ((zuint128)1 << 89)) | (((value) >> 51) & ((zuint128)1 << 38)) | \
|
344
|
+
(((value) << 49) & ((zuint128)1 << 88)) | (((value) >> 49) & ((zuint128)1 << 39)) | \
|
345
|
+
(((value) << 47) & ((zuint128)1 << 87)) | (((value) >> 47) & ((zuint128)1 << 40)) | \
|
346
|
+
(((value) << 45) & ((zuint128)1 << 86)) | (((value) >> 45) & ((zuint128)1 << 41)) | \
|
347
|
+
(((value) << 43) & ((zuint128)1 << 85)) | (((value) >> 43) & ((zuint128)1 << 42)) | \
|
348
|
+
(((value) << 41) & ((zuint128)1 << 84)) | (((value) >> 41) & ((zuint128)1 << 43)) | \
|
349
|
+
(((value) << 39) & ((zuint128)1 << 83)) | (((value) >> 39) & ((zuint128)1 << 44)) | \
|
350
|
+
(((value) << 37) & ((zuint128)1 << 82)) | (((value) >> 37) & ((zuint128)1 << 45)) | \
|
351
|
+
(((value) << 35) & ((zuint128)1 << 81)) | (((value) >> 35) & ((zuint128)1 << 46)) | \
|
352
|
+
(((value) << 33) & ((zuint128)1 << 80)) | (((value) >> 33) & ((zuint128)1 << 47)) | \
|
353
|
+
(((value) << 31) & ((zuint128)1 << 79)) | (((value) >> 31) & ((zuint128)1 << 48)) | \
|
354
|
+
(((value) << 29) & ((zuint128)1 << 78)) | (((value) >> 29) & ((zuint128)1 << 49)) | \
|
355
|
+
(((value) << 27) & ((zuint128)1 << 77)) | (((value) >> 27) & ((zuint128)1 << 50)) | \
|
356
|
+
(((value) << 25) & ((zuint128)1 << 76)) | (((value) >> 25) & ((zuint128)1 << 51)) | \
|
357
|
+
(((value) << 23) & ((zuint128)1 << 75)) | (((value) >> 23) & ((zuint128)1 << 52)) | \
|
358
|
+
(((value) << 21) & ((zuint128)1 << 74)) | (((value) >> 21) & ((zuint128)1 << 53)) | \
|
359
|
+
(((value) << 19) & ((zuint128)1 << 73)) | (((value) >> 19) & ((zuint128)1 << 54)) | \
|
360
|
+
(((value) << 17) & ((zuint128)1 << 72)) | (((value) >> 17) & ((zuint128)1 << 55)) | \
|
361
|
+
(((value) << 15) & ((zuint128)1 << 71)) | (((value) >> 15) & ((zuint128)1 << 56)) | \
|
362
|
+
(((value) << 13) & ((zuint128)1 << 70)) | (((value) >> 13) & ((zuint128)1 << 57)) | \
|
363
|
+
(((value) << 11) & ((zuint128)1 << 69)) | (((value) >> 11) & ((zuint128)1 << 58)) | \
|
364
|
+
(((value) << 9) & ((zuint128)1 << 68)) | (((value) >> 9) & ((zuint128)1 << 59)) | \
|
365
|
+
(((value) << 7) & ((zuint128)1 << 67)) | (((value) >> 7) & ((zuint128)1 << 60)) | \
|
366
|
+
(((value) << 5) & ((zuint128)1 << 66)) | (((value) >> 5) & ((zuint128)1 << 61)) | \
|
367
|
+
(((value) << 3) & ((zuint128)1 << 65)) | (((value) >> 3) & ((zuint128)1 << 62)) | \
|
368
|
+
(((value) << 1) & ((zuint128)1 << 64)) | (((value) >> 1) & ((zuint128)1 << 63)))
|
369
|
+
|
370
|
+
# define Z_128BIT_REVERSE_IN_2BIT(value) \
|
371
|
+
( ((value) << 126) | ((value) >> 126) | \
|
372
|
+
(((value) << 122) & ((zuint128)3 << 124)) | (((value) >> 122) & ((zuint128)3 << 2)) | \
|
373
|
+
(((value) << 118) & ((zuint128)3 << 122)) | (((value) >> 118) & ((zuint128)3 << 4)) | \
|
374
|
+
(((value) << 114) & ((zuint128)3 << 120)) | (((value) >> 114) & ((zuint128)3 << 6)) | \
|
375
|
+
(((value) << 110) & ((zuint128)3 << 118)) | (((value) >> 110) & ((zuint128)3 << 8)) | \
|
376
|
+
(((value) << 106) & ((zuint128)3 << 116)) | (((value) >> 106) & ((zuint128)3 << 10)) | \
|
377
|
+
(((value) << 102) & ((zuint128)3 << 114)) | (((value) >> 102) & ((zuint128)3 << 12)) | \
|
378
|
+
(((value) << 98) & ((zuint128)3 << 112)) | (((value) >> 98) & ((zuint128)3 << 14)) | \
|
379
|
+
(((value) << 94) & ((zuint128)3 << 110)) | (((value) >> 94) & ((zuint128)3 << 16)) | \
|
380
|
+
(((value) << 90) & ((zuint128)3 << 108)) | (((value) >> 90) & ((zuint128)3 << 18)) | \
|
381
|
+
(((value) << 86) & ((zuint128)3 << 106)) | (((value) >> 86) & ((zuint128)3 << 20)) | \
|
382
|
+
(((value) << 82) & ((zuint128)3 << 104)) | (((value) >> 82) & ((zuint128)3 << 22)) | \
|
383
|
+
(((value) << 78) & ((zuint128)3 << 102)) | (((value) >> 78) & ((zuint128)3 << 24)) | \
|
384
|
+
(((value) << 74) & ((zuint128)3 << 100)) | (((value) >> 74) & ((zuint128)3 << 26)) | \
|
385
|
+
(((value) << 70) & ((zuint128)3 << 98)) | (((value) >> 70) & ((zuint128)3 << 28)) | \
|
386
|
+
(((value) << 66) & ((zuint128)3 << 96)) | (((value) >> 66) & ((zuint128)3 << 30)) | \
|
387
|
+
(((value) << 62) & ((zuint128)3 << 94)) | (((value) >> 62) & ((zuint128)3 << 32)) | \
|
388
|
+
(((value) << 58) & ((zuint128)3 << 92)) | (((value) >> 58) & ((zuint128)3 << 34)) | \
|
389
|
+
(((value) << 54) & ((zuint128)3 << 90)) | (((value) >> 54) & ((zuint128)3 << 36)) | \
|
390
|
+
(((value) << 50) & ((zuint128)3 << 88)) | (((value) >> 50) & ((zuint128)3 << 38)) | \
|
391
|
+
(((value) << 46) & ((zuint128)3 << 86)) | (((value) >> 46) & ((zuint128)3 << 40)) | \
|
392
|
+
(((value) << 42) & ((zuint128)3 << 84)) | (((value) >> 42) & ((zuint128)3 << 42)) | \
|
393
|
+
(((value) << 38) & ((zuint128)3 << 82)) | (((value) >> 38) & ((zuint128)3 << 44)) | \
|
394
|
+
(((value) << 34) & ((zuint128)3 << 80)) | (((value) >> 34) & ((zuint128)3 << 46)) | \
|
395
|
+
(((value) << 30) & ((zuint128)3 << 78)) | (((value) >> 30) & ((zuint128)3 << 48)) | \
|
396
|
+
(((value) << 26) & ((zuint128)3 << 76)) | (((value) >> 26) & ((zuint128)3 << 50)) | \
|
397
|
+
(((value) << 22) & ((zuint128)3 << 74)) | (((value) >> 22) & ((zuint128)3 << 52)) | \
|
398
|
+
(((value) << 18) & ((zuint128)3 << 72)) | (((value) >> 18) & ((zuint128)3 << 54)) | \
|
399
|
+
(((value) << 14) & ((zuint128)3 << 70)) | (((value) >> 14) & ((zuint128)3 << 56)) | \
|
400
|
+
(((value) << 10) & ((zuint128)3 << 68)) | (((value) >> 10) & ((zuint128)3 << 58)) | \
|
401
|
+
(((value) << 6) & ((zuint128)3 << 66)) | (((value) >> 6) & ((zuint128)3 << 60)) | \
|
402
|
+
(((value) << 2) & ((zuint128)3 << 64)) | (((value) >> 2) & ((zuint128)3 << 62)))
|
403
|
+
|
404
|
+
# define Z_128BIT_REVERSE_IN_4BIT(value) \
|
405
|
+
( ((value) << 124) | ((value) >> 124) | \
|
406
|
+
(((value) << 116) & ((zuint128)15 << 120)) | (((value) >> 116) & ((zuint128)15 << 4)) | \
|
407
|
+
(((value) << 108) & ((zuint128)15 << 116)) | (((value) >> 108) & ((zuint128)15 << 8)) | \
|
408
|
+
(((value) << 100) & ((zuint128)15 << 112)) | (((value) >> 100) & ((zuint128)15 << 12)) | \
|
409
|
+
(((value) << 92) & ((zuint128)15 << 108)) | (((value) >> 92) & ((zuint128)15 << 16)) | \
|
410
|
+
(((value) << 84) & ((zuint128)15 << 104)) | (((value) >> 84) & ((zuint128)15 << 20)) | \
|
411
|
+
(((value) << 76) & ((zuint128)15 << 100)) | (((value) >> 76) & ((zuint128)15 << 24)) | \
|
412
|
+
(((value) << 68) & ((zuint128)15 << 96)) | (((value) >> 68) & ((zuint128)15 << 28)) | \
|
413
|
+
(((value) << 60) & ((zuint128)15 << 92)) | (((value) >> 60) & ((zuint128)15 << 32)) | \
|
414
|
+
(((value) << 52) & ((zuint128)15 << 88)) | (((value) >> 52) & ((zuint128)15 << 36)) | \
|
415
|
+
(((value) << 44) & ((zuint128)15 << 84)) | (((value) >> 44) & ((zuint128)15 << 40)) | \
|
416
|
+
(((value) << 36) & ((zuint128)15 << 80)) | (((value) >> 36) & ((zuint128)15 << 44)) | \
|
417
|
+
(((value) << 28) & ((zuint128)15 << 76)) | (((value) >> 28) & ((zuint128)15 << 48)) | \
|
418
|
+
(((value) << 20) & ((zuint128)15 << 72)) | (((value) >> 20) & ((zuint128)15 << 52)) | \
|
419
|
+
(((value) << 12) & ((zuint128)15 << 68)) | (((value) >> 12) & ((zuint128)15 << 56)) | \
|
420
|
+
(((value) << 4) & ((zuint128)15 << 64)) | (((value) >> 4) & ((zuint128)15 << 60)))
|
421
|
+
|
422
|
+
# define Z_128BIT_REVERSE_IN_8BIT(value) \
|
423
|
+
( ((value) << 120) | ((value) >> 120) | \
|
424
|
+
(((value) << 104) & ((zuint128)255 << 112)) | (((value) >> 104) & ((zuint128)255 << 8)) | \
|
425
|
+
(((value) << 88) & ((zuint128)255 << 104)) | (((value) >> 88) & ((zuint128)255 << 16)) | \
|
426
|
+
(((value) << 72) & ((zuint128)255 << 96)) | (((value) >> 72) & ((zuint128)255 << 24)) | \
|
427
|
+
(((value) << 56) & ((zuint128)255 << 88)) | (((value) >> 56) & ((zuint128)255 << 32)) | \
|
428
|
+
(((value) << 40) & ((zuint128)255 << 80)) | (((value) >> 40) & ((zuint128)255 << 40)) | \
|
429
|
+
(((value) << 24) & ((zuint128)255 << 72)) | (((value) >> 24) & ((zuint128)255 << 48)) | \
|
430
|
+
(((value) << 8) & ((zuint128)255 << 64)) | (((value) >> 8) & ((zuint128)255 << 56)))
|
431
|
+
|
432
|
+
# define Z_128BIT_REVERSE_IN_16BIT(value) \
|
433
|
+
( ((value) << 112) | ((value) >> 112) | \
|
434
|
+
(((value) << 80) & ((zuint128)65535 << 96)) | (((value) >> 80) & ((zuint128)65535 << 16)) | \
|
435
|
+
(((value) << 48) & ((zuint128)65535 << 80)) | (((value) >> 48) & ((zuint128)65535 << 32)) | \
|
436
|
+
(((value) << 16) & ((zuint128)65535 << 64)) | (((value) >> 16) & ((zuint128)65535 << 48)))
|
437
|
+
|
438
|
+
# define Z_128BIT_REVERSE_IN_32BIT(value) \
|
439
|
+
( ((value) << 96) | ((value) >> 96) | \
|
440
|
+
(((value) << 32) & ((zuint128)4294967295 << 64)) | (((value) >> 32) & ((zuint128)4294967295 << 32)))
|
441
|
+
|
442
|
+
# define Z_128BIT_REVERSE_IN_64BIT(value) \
|
443
|
+
(((value) << 64) | ((value) >> 64))
|
444
|
+
|
445
|
+
# define Z_128BIT_ROTATE_LEFT(value, rotation) \
|
446
|
+
(((value) << (rotation)) | ((value) >> (128 - (rotation))))
|
447
|
+
|
448
|
+
# define Z_128BIT_ROTATE_RIGHT(value, rotation) \
|
449
|
+
(((value) >> (rotation)) | ((value) << (128 - (rotation))))
|
450
|
+
|
451
|
+
# if Z_UINT128_ENDIANNESS == Z_ENDIANNESS_BIG
|
452
|
+
# define Z_128BIT_BIG_ENDIAN Z_SAME
|
453
|
+
# define Z_128BIT_LITTLE_ENDIAN Z_128BIT_REVERSE_IN_8BIT
|
454
|
+
|
455
|
+
# elif Z_UINT128_ENDIANNESS == Z_ENDIANNESS_LITTLE
|
456
|
+
# define Z_128BIT_BIG_ENDIAN Z_128BIT_REVERSE_IN_8BIT
|
457
|
+
# define Z_128BIT_LITTLE_ENDIAN Z_SAME
|
458
|
+
# endif
|
459
|
+
|
460
|
+
#endif
|
461
|
+
|
462
|
+
/* MARK: - Top integer operations */
|
463
|
+
|
464
|
+
#if Z_BINTTOP_BITS == 16
|
465
|
+
# define Z_8BIT_TOP_MIRROR Z_8BIT_16BIT_MIRROR
|
466
|
+
|
467
|
+
#elif Z_BINTTOP_BITS == 32
|
468
|
+
# define Z_8BIT_TOP_MIRROR Z_8BIT_32BIT_MIRROR
|
469
|
+
# define Z_16BIT_TOP_MIRROR Z_16BIT_32BIT_MIRROR
|
470
|
+
|
471
|
+
#elif Z_BINTTOP_BITS == 64
|
472
|
+
# define Z_8BIT_TOP_MIRROR Z_8BIT_64BIT_MIRROR
|
473
|
+
# define Z_16BIT_TOP_MIRROR Z_16BIT_64BIT_MIRROR
|
474
|
+
# define Z_32BIT_TOP_MIRROR Z_32BIT_64BIT_MIRROR
|
475
|
+
|
476
|
+
#elif Z_BINTTOP_BITS == 128
|
477
|
+
# define Z_8BIT_TOP_MIRROR Z_8BIT_128BIT_MIRROR
|
478
|
+
# define Z_16BIT_TOP_MIRROR Z_16BIT_128BIT_MIRROR
|
479
|
+
# define Z_32BIT_TOP_MIRROR Z_32BIT_128BIT_MIRROR
|
480
|
+
# define Z_64BIT_TOP_MIRROR Z_64BIT_128BIT_MIRROR
|
481
|
+
#endif
|
482
|
+
|
483
|
+
/* MARK: - Macro selectors */
|
484
|
+
|
485
|
+
#define Z_TYPE_REVERSE( TYPE) Z_INSERT_##TYPE##_BITS(Z_, BIT_REVERSE_IN_8BIT)
|
486
|
+
#define Z_TYPE_BIG_ENDIAN( TYPE) Z_INSERT_##TYPE##_BITS(Z_, BIT_BIG_ENDIAN )
|
487
|
+
#define Z_TYPE_LITTLE_ENDIAN(TYPE) Z_INSERT_##TYPE##_BITS(Z_, BIT_LITTLE_ENDIAN )
|
488
|
+
|
489
|
+
#endif /* _Z_macros_value_H_ */
|
@@ -0,0 +1,21 @@
|
|
1
|
+
/* Z Kit - macros/variadic pasting.h
|
2
|
+
_____ _______________
|
3
|
+
/_ /_/ -_/_ _/ _ |
|
4
|
+
/____/\___/ /__//___/_| Kit
|
5
|
+
Copyright (C) 2006-2018 Manuel Sainz de Baranda y Goñi.
|
6
|
+
Released under the terms of the GNU Lesser General Public License v3. */
|
7
|
+
|
8
|
+
#ifndef _Z_macros_variadic_pasting_H_
|
9
|
+
#define _Z_macros_variadic_pasting_H_
|
10
|
+
|
11
|
+
#include <Z/macros/variadic.h>
|
12
|
+
|
13
|
+
#if !defined(Z_AVOID_VARIADIC_MACROS) && \
|
14
|
+
(Z_LANGUAGE_HAS(C, VARIADIC_MACRO) || Z_LANGUAGE_HAS(CPP, C99_PREPROCESSOR))
|
15
|
+
|
16
|
+
# define Z_JOIN_N(n) Z_PASTE_2(Z_JOIN_, n) /* Needed for Z_JOIN(...) only */
|
17
|
+
# define Z_JOIN(...) Z_SAME(Z_JOIN_N(Z_ARGUMENT_COUNT_(__VA_ARGS__, L_PP_RSEQ_N())))(__VA_ARGS__)
|
18
|
+
|
19
|
+
#endif
|
20
|
+
|
21
|
+
#endif /* _Z_macros_variadic_pasting_H_ */
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/* Z Kit - macros/variadic selection.h
|
2
|
+
_____ _______________
|
3
|
+
/_ /_/ -_/_ _/ _ |
|
4
|
+
/____/\___/ /__//___/_| Kit
|
5
|
+
Copyright (C) 2015 Petr Kobalicek <kobalicek.petr@gmail.com>.
|
6
|
+
Copyright (C) 2006-2018 Manuel Sainz de Baranda y Goñi.
|
7
|
+
Released under the terms of the GNU Lesser General Public License v3. */
|
8
|
+
|
9
|
+
#ifndef _Z_macros_variadic_selection_H_
|
10
|
+
#define _Z_macros_variadic_selection_H_
|
11
|
+
|
12
|
+
#include <Z/inspection/language.h>
|
13
|
+
|
14
|
+
#if !defined(Z_AVOID_VARIADIC_MACROS) && \
|
15
|
+
(Z_LANGUAGE_HAS(C, VARIADIC_MACRO) || Z_LANGUAGE_HAS(CPP, C99_PREPROCESSOR))
|
16
|
+
|
17
|
+
# include <Z/macros/pasting.h>
|
18
|
+
|
19
|
+
# define Z_SELECT_0( _0, ...) _0
|
20
|
+
# define Z_SELECT_1( _0, _1, ...) _1
|
21
|
+
# define Z_SELECT_2( _0, _1, _2, ...) _2
|
22
|
+
# define Z_SELECT_3( _0, _1, _2, _3, ...) _3
|
23
|
+
# define Z_SELECT_4( _0, _1, _2, _3, _4, ...) _4
|
24
|
+
# define Z_SELECT_5( _0, _1, _2, _3, _4, _5, ...) _5
|
25
|
+
# define Z_SELECT_6( _0, _1, _2, _3, _4, _5, _6, ...) _6
|
26
|
+
# define Z_SELECT_7( _0, _1, _2, _3, _4, _5, _6, _7, ...) _7
|
27
|
+
# define Z_SELECT_8( _0, _1, _2, _3, _4, _5, _6, _7, _8, ...) _8
|
28
|
+
# define Z_SELECT_9( _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, ...) _9
|
29
|
+
# define Z_SELECT_10(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, ...) _10
|
30
|
+
# define Z_SELECT_11(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, ...) _11
|
31
|
+
# define Z_SELECT_12(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, ...) _12
|
32
|
+
# define Z_SELECT_13(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, ...) _13
|
33
|
+
# define Z_SELECT_14(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, ...) _14
|
34
|
+
# define Z_SELECT_15(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, ...) _15
|
35
|
+
# define Z_SELECT_16(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, ...) _16
|
36
|
+
# define Z_SELECT_17(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, ...) _17
|
37
|
+
# define Z_SELECT_18(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, ...) _18
|
38
|
+
# define Z_SELECT_19(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, ...) _19
|
39
|
+
# define Z_SELECT_20(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, ...) _20
|
40
|
+
# define Z_SELECT_21(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, ...) _21
|
41
|
+
# define Z_SELECT_22(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, ...) _22
|
42
|
+
# define Z_SELECT_23(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, ...) _23
|
43
|
+
# define Z_SELECT_24(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, ...) _24
|
44
|
+
# define Z_SELECT_25(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, ...) _25
|
45
|
+
# define Z_SELECT_26(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, ...) _26
|
46
|
+
# define Z_SELECT_27(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, ...) _27
|
47
|
+
# define Z_SELECT_28(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, ...) _28
|
48
|
+
# define Z_SELECT_29(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, ...) _29
|
49
|
+
# define Z_SELECT_30(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, ...) _30
|
50
|
+
# define Z_SELECT_31(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, ...) _31
|
51
|
+
|
52
|
+
# define Z_SELECT(index, ...) Z_JOIN_2(Z_SELECT_, index)(__VA_ARGS__, Z_DUMMY)
|
53
|
+
|
54
|
+
#endif
|
55
|
+
|
56
|
+
#endif /* _Z_macros_variadic_selection_H_ */
|
@@ -0,0 +1,46 @@
|
|
1
|
+
/* Z Kit - macros/variadic.h
|
2
|
+
_____ _______________
|
3
|
+
/_ /_/ -_/_ _/ _ |
|
4
|
+
/____/\___/ /__//___/_| Kit
|
5
|
+
Copyright (C) 2006 Laurent Deniau <laurent.deniau@cern.ch>.
|
6
|
+
Copyright (C) 2006-2018 Manuel Sainz de Baranda y Goñi.
|
7
|
+
Released under the terms of the GNU Lesser General Public License v3. */
|
8
|
+
|
9
|
+
#ifndef _Z_macros_variadic_H_
|
10
|
+
#define _Z_macros_variadic_H_
|
11
|
+
|
12
|
+
#include <Z/inspection/language.h>
|
13
|
+
|
14
|
+
#if !defined(Z_AVOID_VARIADIC_MACROS) && \
|
15
|
+
(Z_LANGUAGE_HAS(C, VARIADIC_MACRO) || Z_LANGUAGE_HAS(CPP, C99_PREPROCESSOR))
|
16
|
+
|
17
|
+
# include <Z/macros/pasting.h>
|
18
|
+
|
19
|
+
# define L_PP_ARG_N( \
|
20
|
+
_1, _2, _3, _4, _5, _6, _7, _8, \
|
21
|
+
_9, _10, _11, _12, _13, _14, _15, _16, \
|
22
|
+
_17, _18, _19, _20, _21, _22, _23, _24, \
|
23
|
+
_25, _26, _27, _28, _29, _30, _31, _32, \
|
24
|
+
_33, _34, _35, _36, _37, _38, _39, _40, \
|
25
|
+
_41, _42, _43, _44, _45, _46, _47, _48, \
|
26
|
+
_49, _50, _51, _52, _53, _54, _55, _56, \
|
27
|
+
_57, _58, _59, _60, _61, _62, _63, n, \
|
28
|
+
... \
|
29
|
+
) n
|
30
|
+
|
31
|
+
# define L_PP_RSEQ_N() \
|
32
|
+
63, 62, 61, 60, 59, 58, 57, 56, \
|
33
|
+
55, 54, 53, 52, 51, 50, 49, 48, \
|
34
|
+
47, 46, 45, 44, 43, 42, 41, 40, \
|
35
|
+
39, 38, 37, 36, 35, 34, 33, 32, \
|
36
|
+
31, 30, 29, 28, 27, 26, 25, 24, \
|
37
|
+
23, 22, 21, 20, 19, 18, 17, 16, \
|
38
|
+
15, 14, 13, 12, 11, 10, 9, 8, \
|
39
|
+
7, 6, 5, 4, 3, 2, 1, 0
|
40
|
+
|
41
|
+
# define Z_ARGUMENT_COUNT_(...) Z_SAME(L_PP_ARG_N(__VA_ARGS__))
|
42
|
+
# define Z_ARGUMENT_COUNT( ...) Z_ARGUMENT_COUNT_(__VA_ARGS__, L_PP_RSEQ_N())
|
43
|
+
|
44
|
+
#endif
|
45
|
+
|
46
|
+
#endif /* _Z_macros_variadic_H_ */
|
@@ -0,0 +1,17 @@
|
|
1
|
+
/* Z Kit - macros/version.h
|
2
|
+
_____ _______________
|
3
|
+
/_ /_/ -_/_ _/ _ |
|
4
|
+
/____/\___/ /__//___/_| Kit
|
5
|
+
Copyright (C) 2006-2018 Manuel Sainz de Baranda y Goñi.
|
6
|
+
Released under the terms of the GNU Lesser General Public License v3. */
|
7
|
+
|
8
|
+
#ifndef _Z_macros_version_H_
|
9
|
+
#define _Z_macros_version_H_
|
10
|
+
|
11
|
+
#define Z_VERSION(major, minor, micro) ((major) * 4194304UL + (minor) * 4096UL + (micro))
|
12
|
+
#define Z_VERSION_MAJOR(version) ((version) / 4194304UL)
|
13
|
+
#define Z_VERSION_MINOR(version) (((version) % 4194304UL) / 4096UL)
|
14
|
+
#define Z_VERSION_MICRO(version) ((version) & 0xFFFUL)
|
15
|
+
|
16
|
+
#endif /* _Z_macros_version_H_ */
|
17
|
+
|