zemu 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,1901 @@
|
|
1
|
+
/* Z Kit - functions/base/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_functions_base_value_H_
|
9
|
+
#define _Z_functions_base_value_H_
|
10
|
+
|
11
|
+
#include <Z/macros/value.h>
|
12
|
+
|
13
|
+
|
14
|
+
/* MARK: - Common implementation */
|
15
|
+
|
16
|
+
|
17
|
+
#define Z_IMPLEMENTATION_COMMON(type) \
|
18
|
+
\
|
19
|
+
static Z_INLINE \
|
20
|
+
z##type z_##type##_maximum(z##type a, z##type b) \
|
21
|
+
{return Z_MAXIMUM(a, b);} \
|
22
|
+
\
|
23
|
+
\
|
24
|
+
static Z_INLINE \
|
25
|
+
z##type z_##type##_minimum(z##type a, z##type b) \
|
26
|
+
{return Z_MINIMUM(a, b);} \
|
27
|
+
\
|
28
|
+
\
|
29
|
+
static Z_INLINE \
|
30
|
+
z##type z_##type##_clamp(z##type value, z##type minimum, z##type maximum) \
|
31
|
+
{return z_##type##_minimum(z_##type##_maximum(value, minimum), maximum);} \
|
32
|
+
\
|
33
|
+
\
|
34
|
+
static Z_INLINE \
|
35
|
+
void z_##type##_swap(void *a, void *b) \
|
36
|
+
{ \
|
37
|
+
z##type t = *(z##type *)a; \
|
38
|
+
\
|
39
|
+
*(z##type *)a = *(z##type *)b; \
|
40
|
+
*(z##type *)b = t; \
|
41
|
+
}
|
42
|
+
|
43
|
+
|
44
|
+
#define z_type_clamp( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _clamp )
|
45
|
+
#define z_type_maximum(TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _maximum)
|
46
|
+
#define z_type_minimum(TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _minimum)
|
47
|
+
#define z_type_swap( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _swap )
|
48
|
+
|
49
|
+
|
50
|
+
/* MARK: - Partial implementation for signed types */
|
51
|
+
|
52
|
+
|
53
|
+
#define Z_IMPLEMENTATION_SIGNED(type) \
|
54
|
+
\
|
55
|
+
static Z_INLINE \
|
56
|
+
z##type z_##type##_absolute(z##type value) \
|
57
|
+
{return value < (z##type)0 ? -value : value;} \
|
58
|
+
\
|
59
|
+
\
|
60
|
+
static Z_INLINE \
|
61
|
+
z##type z_##type##_sign(z##type value) \
|
62
|
+
{return value >= (z##type)0 ? (z##type)1 : -(z##type)1;}
|
63
|
+
|
64
|
+
|
65
|
+
#define z_type_absolute(TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _absolute)
|
66
|
+
#define z_type_sign( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _sign )
|
67
|
+
|
68
|
+
|
69
|
+
/* MARK: - Implementation for real types */
|
70
|
+
|
71
|
+
|
72
|
+
#define Z_IMPLEMENTATION_REAL(type, _, epsilon, infinity) \
|
73
|
+
\
|
74
|
+
static Z_INLINE \
|
75
|
+
zboolean z_##type##_are_almost_equal(z##type a, z##type b) \
|
76
|
+
{return z_##type##_absolute(a - b) <= epsilon;} \
|
77
|
+
\
|
78
|
+
\
|
79
|
+
static Z_INLINE \
|
80
|
+
z##type z_##type##_clamp_01(z##type value) \
|
81
|
+
{return z_##type##_minimum(z_##type##_maximum(value, _(0.0)), _(1.0));} \
|
82
|
+
\
|
83
|
+
\
|
84
|
+
static Z_INLINE \
|
85
|
+
z##type z_##type##_inverse_lerp(z##type a, z##type b, z##type t) \
|
86
|
+
{return (t - a) / (b - a);} \
|
87
|
+
\
|
88
|
+
\
|
89
|
+
static Z_INLINE \
|
90
|
+
zboolean z_##type##_is_almost_zero(z##type value) \
|
91
|
+
{return z_##type##_absolute(value) <= epsilon;} \
|
92
|
+
\
|
93
|
+
\
|
94
|
+
static Z_INLINE \
|
95
|
+
zboolean z_##type##_is_finite(z##type value) \
|
96
|
+
{return value == value && value != infinity && value != -infinity;} \
|
97
|
+
\
|
98
|
+
\
|
99
|
+
static Z_INLINE \
|
100
|
+
zboolean z_##type##_is_infinity(z##type value) \
|
101
|
+
{return value == infinity || value == -infinity;} \
|
102
|
+
\
|
103
|
+
\
|
104
|
+
static Z_INLINE \
|
105
|
+
zboolean z_##type##_is_nan(z##type value) \
|
106
|
+
{return !(value == value);} \
|
107
|
+
\
|
108
|
+
\
|
109
|
+
static Z_INLINE \
|
110
|
+
z##type z_##type##_lerp(z##type a, z##type b, z##type t) \
|
111
|
+
{return a + t * (b - a);} \
|
112
|
+
\
|
113
|
+
\
|
114
|
+
static Z_INLINE \
|
115
|
+
z##type z_##type##_sign_or_zero(z##type value) \
|
116
|
+
{ \
|
117
|
+
return z_##type##_absolute(value) <= epsilon \
|
118
|
+
? _(0.0) \
|
119
|
+
: z_##type##_sign(value); \
|
120
|
+
} \
|
121
|
+
\
|
122
|
+
\
|
123
|
+
static Z_INLINE \
|
124
|
+
z##type z_##type##_smootherstep(z##type a, z##type b, z##type t) \
|
125
|
+
{ \
|
126
|
+
if (t <= a) return _(0.0); \
|
127
|
+
if (t >= b) return _(1.0); \
|
128
|
+
t = (t - a) / (b - a); \
|
129
|
+
return t * t * t * (t * (t * _(6.0) - _(15.0)) + _(10.0)); \
|
130
|
+
} \
|
131
|
+
\
|
132
|
+
\
|
133
|
+
static Z_INLINE \
|
134
|
+
z##type z_##type##_smoothstep(z##type a, z##type b, z##type t) \
|
135
|
+
{ \
|
136
|
+
if (t <= a) return _(0.0); \
|
137
|
+
if (t >= b) return _(1.0); \
|
138
|
+
t = (t - a) / (b - a); \
|
139
|
+
return t * t * (_(3.0) - _(2.0) * t); \
|
140
|
+
}
|
141
|
+
|
142
|
+
|
143
|
+
#define z_type_are_almost_equal(TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _are_almost_equal)
|
144
|
+
#define z_type_clamp_01( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _clamp_01 )
|
145
|
+
#define z_type_inverse_lerp( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _inverse_lerp )
|
146
|
+
#define z_type_is_almost_zero( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _is_almost_zero )
|
147
|
+
#define z_type_is_finite( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _is_finite )
|
148
|
+
#define z_type_is_infinity( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _is_infinity )
|
149
|
+
#define z_type_is_nan( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _is_nan )
|
150
|
+
#define z_type_lerp( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _lerp )
|
151
|
+
#define z_type_sign_or_zero( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _sign_or_zero )
|
152
|
+
#define z_type_smootherstep( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _smootherstep )
|
153
|
+
#define z_type_smoothstep( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _smoothstep )
|
154
|
+
|
155
|
+
|
156
|
+
/* MARK: - Partial implementations for bit operations */
|
157
|
+
|
158
|
+
|
159
|
+
#define Z_IMPLEMENTATION_REVERSE(type, bits, level) \
|
160
|
+
\
|
161
|
+
static Z_INLINE \
|
162
|
+
z##type z_##type##_reverse_in_##level##bit(z##type value) \
|
163
|
+
{return (z##type)Z_##bits##BIT_REVERSE_IN_##level##BIT((zuint##bits)value);}
|
164
|
+
|
165
|
+
|
166
|
+
#define z_type_reverse(TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _reverse_in_8bit)
|
167
|
+
|
168
|
+
|
169
|
+
#define Z_IMPLEMENTATION_ROTATE(type, bits) \
|
170
|
+
\
|
171
|
+
static Z_INLINE \
|
172
|
+
z##type z_##type##_rotate_left(z##type value, zuint rotation) \
|
173
|
+
{return (z##type)Z_##bits##BIT_ROTATE_LEFT((zuint##bits)value, rotation);} \
|
174
|
+
\
|
175
|
+
\
|
176
|
+
static Z_INLINE \
|
177
|
+
z##type z_##type##_rotate_right(z##type value, zuint rotation) \
|
178
|
+
{return (z##type)Z_##bits##BIT_ROTATE_RIGHT((zuint##bits)value, rotation);}
|
179
|
+
|
180
|
+
|
181
|
+
#define z_type_rotate_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _rotate_left )
|
182
|
+
#define z_type_rotate_right(TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _rotate_right)
|
183
|
+
|
184
|
+
|
185
|
+
/* MARK: - uint8 */
|
186
|
+
|
187
|
+
|
188
|
+
Z_IMPLEMENTATION_COMMON (uint8)
|
189
|
+
Z_IMPLEMENTATION_REVERSE(uint8, 8, 1)
|
190
|
+
Z_IMPLEMENTATION_REVERSE(uint8, 8, 2)
|
191
|
+
Z_IMPLEMENTATION_REVERSE(uint8, 8, 4)
|
192
|
+
Z_IMPLEMENTATION_ROTATE (uint8, 8)
|
193
|
+
|
194
|
+
|
195
|
+
#define z_uint8_reverse Z_SAME
|
196
|
+
|
197
|
+
|
198
|
+
static Z_INLINE
|
199
|
+
zboolean z_uint8_addition_overflows(zuint8 a, zuint8 b)
|
200
|
+
{return (zuint16)a + (zuint16)b > Z_UINT8_MAXIMUM;}
|
201
|
+
|
202
|
+
|
203
|
+
static Z_INLINE
|
204
|
+
zboolean z_uint8_addition_overflows_3(zuint8 a, zuint8 b, zuint8 c)
|
205
|
+
{return (zuint16)a + (zuint16)b + (zuint16)c > Z_UINT8_MAXIMUM;}
|
206
|
+
|
207
|
+
|
208
|
+
static Z_INLINE
|
209
|
+
zboolean z_uint8_addition_overflows_4(zuint8 a, zuint8 b, zuint8 c, zuint8 d)
|
210
|
+
{return (zuint16)a + (zuint16)b + (zuint16)c + (zuint16)d > Z_UINT8_MAXIMUM;}
|
211
|
+
|
212
|
+
|
213
|
+
static Z_INLINE
|
214
|
+
zboolean z_uint8_multiplication_overflows(zuint8 a, zuint8 b)
|
215
|
+
{return (zuint16)a * (zuint16)b > Z_UINT8_MAXIMUM;}
|
216
|
+
|
217
|
+
|
218
|
+
/*static Z_INLINE
|
219
|
+
zboolean z_uint8_multiplication_overflows_3(zuint8 a, zuint8 b, zuint8 c)
|
220
|
+
{return FALSE;}
|
221
|
+
|
222
|
+
|
223
|
+
static Z_INLINE
|
224
|
+
zboolean z_uint8_multiplication_overflows_4(zuint8 a, zuint8 b, zuint8 c, zuint8 d)
|
225
|
+
{return FALSE;}*/
|
226
|
+
|
227
|
+
|
228
|
+
static Z_INLINE
|
229
|
+
zboolean z_uint8_subtraction_overflows(zuint8 a, zuint8 b)
|
230
|
+
{return b > a;}
|
231
|
+
|
232
|
+
|
233
|
+
/*static Z_INLINE
|
234
|
+
zboolean z_uint8_subtraction_overflows_3(zuint8 a, zuint8 b, zuint8 c)
|
235
|
+
{return FALSE;}
|
236
|
+
|
237
|
+
|
238
|
+
static Z_INLINE
|
239
|
+
zboolean z_uint8_subtraction_overflows_4(zuint8 a, zuint8 b, zuint8 c, zuint8 d)
|
240
|
+
{return FALSE;}*/
|
241
|
+
|
242
|
+
|
243
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_ADD_THEN_GET)
|
244
|
+
# define z_uint8_atomic_add_then_get Z_COMPILER_FUNCTION(UINT8_ATOMIC_ADD_THEN_GET)
|
245
|
+
#endif
|
246
|
+
|
247
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_AND_THEN_GET)
|
248
|
+
# define z_uint8_atomic_and_then_get Z_COMPILER_FUNCTION(UINT8_ATOMIC_AND_THEN_GET)
|
249
|
+
#endif
|
250
|
+
|
251
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_DECREMENT_THEN_GET)
|
252
|
+
# define z_uint8_atomic_decrement_then_get Z_COMPILER_FUNCTION(UINT8_ATOMIC_DECREMENT_THEN_GET)
|
253
|
+
#endif
|
254
|
+
|
255
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_GET_THEN_ADD)
|
256
|
+
# define z_uint8_atomic_get_then_add Z_COMPILER_FUNCTION(UINT8_ATOMIC_GET_THEN_ADD)
|
257
|
+
#endif
|
258
|
+
|
259
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_GET_THEN_AND)
|
260
|
+
# define z_uint8_atomic_get_then_and Z_COMPILER_FUNCTION(UINT8_ATOMIC_GET_THEN_AND)
|
261
|
+
#endif
|
262
|
+
|
263
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_GET_THEN_DECREMENT)
|
264
|
+
# define z_uint8_atomic_get_then_decrement Z_COMPILER_FUNCTION(UINT8_ATOMIC_GET_THEN_DECREMENT)
|
265
|
+
#endif
|
266
|
+
|
267
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_GET_THEN_INCREMENT)
|
268
|
+
# define z_uint8_atomic_get_then_increment Z_COMPILER_FUNCTION(UINT8_ATOMIC_GET_THEN_INCREMENT)
|
269
|
+
#endif
|
270
|
+
|
271
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_GET_THEN_NAND)
|
272
|
+
# define z_uint8_atomic_get_then_nand Z_COMPILER_FUNCTION(UINT8_ATOMIC_GET_THEN_NAND)
|
273
|
+
#endif
|
274
|
+
|
275
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_GET_THEN_NOT)
|
276
|
+
# define z_uint8_atomic_get_then_not Z_COMPILER_FUNCTION(UINT8_ATOMIC_GET_THEN_NOT)
|
277
|
+
#endif
|
278
|
+
|
279
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_GET_THEN_OR)
|
280
|
+
# define z_uint8_atomic_get_then_or Z_COMPILER_FUNCTION(UINT8_ATOMIC_GET_THEN_OR)
|
281
|
+
#endif
|
282
|
+
|
283
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_GET_THEN_SET)
|
284
|
+
# define z_uint8_atomic_get_then_set Z_COMPILER_FUNCTION(UINT8_ATOMIC_GET_THEN_SET)
|
285
|
+
#endif
|
286
|
+
|
287
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_GET_THEN_SUBTRACT)
|
288
|
+
# define z_uint8_atomic_get_then_subtract Z_COMPILER_FUNCTION(UINT8_ATOMIC_GET_THEN_SUBTRACT)
|
289
|
+
#endif
|
290
|
+
|
291
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_GET_THEN_XOR)
|
292
|
+
# define z_uint8_atomic_get_then_xor Z_COMPILER_FUNCTION(UINT8_ATOMIC_GET_THEN_XOR)
|
293
|
+
#endif
|
294
|
+
|
295
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_INCREMENT_THEN_GET)
|
296
|
+
# define z_uint8_atomic_increment_then_get Z_COMPILER_FUNCTION(UINT8_ATOMIC_INCREMENT_THEN_GET)
|
297
|
+
#endif
|
298
|
+
|
299
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_NAND_THEN_GET)
|
300
|
+
# define z_uint8_atomic_nand_then_get Z_COMPILER_FUNCTION(UINT8_ATOMIC_NAND_THEN_GET)
|
301
|
+
#endif
|
302
|
+
|
303
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_NOT_THEN_GET)
|
304
|
+
# define z_uint8_atomic_not_then_get Z_COMPILER_FUNCTION(UINT8_ATOMIC_NOT_THEN_GET)
|
305
|
+
#endif
|
306
|
+
|
307
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_OR_THEN_GET)
|
308
|
+
# define z_uint8_atomic_or_then_get Z_COMPILER_FUNCTION(UINT8_ATOMIC_OR_THEN_GET)
|
309
|
+
#endif
|
310
|
+
|
311
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_SET_IF_EQUAL)
|
312
|
+
# define z_uint8_atomic_set_if_equal Z_COMPILER_FUNCTION(UINT8_ATOMIC_SET_IF_EQUAL)
|
313
|
+
#endif
|
314
|
+
|
315
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_SUBTRACT_THEN_GET)
|
316
|
+
# define z_uint8_atomic_subtract_then_get Z_COMPILER_FUNCTION(UINT8_ATOMIC_SUBTRACT_THEN_GET)
|
317
|
+
#endif
|
318
|
+
|
319
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT8_ATOMIC_XOR_THEN_GET)
|
320
|
+
# define z_uint8_atomic_xor_then_get Z_COMPILER_FUNCTION(UINT8_ATOMIC_XOR_THEN_GET)
|
321
|
+
#endif
|
322
|
+
|
323
|
+
|
324
|
+
/* MARK: - sint8 */
|
325
|
+
|
326
|
+
|
327
|
+
Z_IMPLEMENTATION_COMMON (sint8)
|
328
|
+
Z_IMPLEMENTATION_SIGNED (sint8)
|
329
|
+
Z_IMPLEMENTATION_REVERSE(sint8, 8, 1)
|
330
|
+
Z_IMPLEMENTATION_REVERSE(sint8, 8, 2)
|
331
|
+
Z_IMPLEMENTATION_REVERSE(sint8, 8, 4)
|
332
|
+
Z_IMPLEMENTATION_ROTATE (sint8, 8)
|
333
|
+
|
334
|
+
|
335
|
+
#define z_sint8_reverse Z_SAME
|
336
|
+
|
337
|
+
|
338
|
+
/*static Z_INLINE
|
339
|
+
zboolean z_sint8_addition_overflows(zsint8 a, zsint8 b)
|
340
|
+
{return FALSE;}
|
341
|
+
|
342
|
+
|
343
|
+
static Z_INLINE
|
344
|
+
zboolean z_sint8_addition_overflows_3(zsint8 a, zsint8 b, zsint8 c)
|
345
|
+
{return FALSE;}
|
346
|
+
|
347
|
+
|
348
|
+
static Z_INLINE
|
349
|
+
zboolean z_sint8_addition_overflows_4(zsint8 a, zsint8 b, zsint8 c, zsint8 d)
|
350
|
+
{return FALSE;}
|
351
|
+
|
352
|
+
|
353
|
+
static Z_INLINE
|
354
|
+
zboolean z_sint8_multiplication_overflows(zsint8 a, zsint8 b)
|
355
|
+
{return FALSE;}
|
356
|
+
|
357
|
+
|
358
|
+
static Z_INLINE
|
359
|
+
zboolean z_sint8_multiplication_overflows_3(zsint8 a, zsint8 b, zsint8 c)
|
360
|
+
{return FALSE;}
|
361
|
+
|
362
|
+
|
363
|
+
static Z_INLINE
|
364
|
+
zboolean z_sint8_multiplication_overflows_4(zsint8 a, zsint8 b, zsint8 c, zsint8 d)
|
365
|
+
{return FALSE;}
|
366
|
+
|
367
|
+
|
368
|
+
static Z_INLINE
|
369
|
+
zboolean z_sint8_subtraction_overflows(zsint8 a, zsint8 b)
|
370
|
+
{return FALSE;}
|
371
|
+
|
372
|
+
|
373
|
+
static Z_INLINE
|
374
|
+
zboolean z_sint8_subtraction_overflows_3(zsint8 a, zsint8 b, zsint8 c)
|
375
|
+
{return FALSE;}
|
376
|
+
|
377
|
+
|
378
|
+
static Z_INLINE
|
379
|
+
zboolean z_sint8_subtraction_overflows_4(zsint8 a, zsint8 b, zsint8 c, zsint8 d)
|
380
|
+
{return FALSE;}*/
|
381
|
+
|
382
|
+
|
383
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_ADD_THEN_GET)
|
384
|
+
# define z_sint8_atomic_add_then_get Z_COMPILER_FUNCTION(SINT8_ATOMIC_ADD_THEN_GET)
|
385
|
+
#endif
|
386
|
+
|
387
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_AND_THEN_GET)
|
388
|
+
# define z_sint8_atomic_and_then_get Z_COMPILER_FUNCTION(SINT8_ATOMIC_AND_THEN_GET)
|
389
|
+
#endif
|
390
|
+
|
391
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_DECREMENT_THEN_GET)
|
392
|
+
# define z_sint8_atomic_decrement_then_get Z_COMPILER_FUNCTION(SINT8_ATOMIC_DECREMENT_THEN_GET)
|
393
|
+
#endif
|
394
|
+
|
395
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_GET_THEN_ADD)
|
396
|
+
# define z_sint8_atomic_get_then_add Z_COMPILER_FUNCTION(SINT8_ATOMIC_GET_THEN_ADD)
|
397
|
+
#endif
|
398
|
+
|
399
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_GET_THEN_AND)
|
400
|
+
# define z_sint8_atomic_get_then_and Z_COMPILER_FUNCTION(SINT8_ATOMIC_GET_THEN_AND)
|
401
|
+
#endif
|
402
|
+
|
403
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_GET_THEN_DECREMENT)
|
404
|
+
# define z_sint8_atomic_get_then_decrement Z_COMPILER_FUNCTION(SINT8_ATOMIC_GET_THEN_DECREMENT)
|
405
|
+
#endif
|
406
|
+
|
407
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_GET_THEN_INCREMENT)
|
408
|
+
# define z_sint8_atomic_get_then_increment Z_COMPILER_FUNCTION(SINT8_ATOMIC_GET_THEN_INCREMENT)
|
409
|
+
#endif
|
410
|
+
|
411
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_GET_THEN_NAND)
|
412
|
+
# define z_sint8_atomic_get_then_nand Z_COMPILER_FUNCTION(SINT8_ATOMIC_GET_THEN_NAND)
|
413
|
+
#endif
|
414
|
+
|
415
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_GET_THEN_NOT)
|
416
|
+
# define z_sint8_atomic_get_then_not Z_COMPILER_FUNCTION(SINT8_ATOMIC_GET_THEN_NOT)
|
417
|
+
#endif
|
418
|
+
|
419
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_GET_THEN_OR)
|
420
|
+
# define z_sint8_atomic_get_then_or Z_COMPILER_FUNCTION(SINT8_ATOMIC_GET_THEN_OR)
|
421
|
+
#endif
|
422
|
+
|
423
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_GET_THEN_SET)
|
424
|
+
# define z_sint8_atomic_get_then_set Z_COMPILER_FUNCTION(SINT8_ATOMIC_GET_THEN_SET)
|
425
|
+
#endif
|
426
|
+
|
427
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_GET_THEN_SUBTRACT)
|
428
|
+
# define z_sint8_atomic_get_then_subtract Z_COMPILER_FUNCTION(SINT8_ATOMIC_GET_THEN_SUBTRACT)
|
429
|
+
#endif
|
430
|
+
|
431
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_GET_THEN_XOR)
|
432
|
+
# define z_sint8_atomic_get_then_xor Z_COMPILER_FUNCTION(SINT8_ATOMIC_GET_THEN_XOR)
|
433
|
+
#endif
|
434
|
+
|
435
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_INCREMENT_THEN_GET)
|
436
|
+
# define z_sint8_atomic_increment_then_get Z_COMPILER_FUNCTION(SINT8_ATOMIC_INCREMENT_THEN_GET)
|
437
|
+
#endif
|
438
|
+
|
439
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_NAND_THEN_GET)
|
440
|
+
# define z_sint8_atomic_nand_then_get Z_COMPILER_FUNCTION(SINT8_ATOMIC_NAND_THEN_GET)
|
441
|
+
#endif
|
442
|
+
|
443
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_NOT_THEN_GET)
|
444
|
+
# define z_sint8_atomic_not_then_get Z_COMPILER_FUNCTION(SINT8_ATOMIC_NOT_THEN_GET)
|
445
|
+
#endif
|
446
|
+
|
447
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_OR_THEN_GET)
|
448
|
+
# define z_sint8_atomic_or_then_get Z_COMPILER_FUNCTION(SINT8_ATOMIC_OR_THEN_GET)
|
449
|
+
#endif
|
450
|
+
|
451
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_SET_IF_EQUAL)
|
452
|
+
# define z_sint8_atomic_set_if_equal Z_COMPILER_FUNCTION(SINT8_ATOMIC_SET_IF_EQUAL)
|
453
|
+
#endif
|
454
|
+
|
455
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_SUBTRACT_THEN_GET)
|
456
|
+
# define z_sint8_atomic_subtract_then_get Z_COMPILER_FUNCTION(SINT8_ATOMIC_SUBTRACT_THEN_GET)
|
457
|
+
#endif
|
458
|
+
|
459
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT8_ATOMIC_XOR_THEN_GET)
|
460
|
+
# define z_sint8_atomic_xor_then_get Z_COMPILER_FUNCTION(SINT8_ATOMIC_XOR_THEN_GET)
|
461
|
+
#endif
|
462
|
+
|
463
|
+
|
464
|
+
/* MARK: - uint16 */
|
465
|
+
|
466
|
+
|
467
|
+
Z_IMPLEMENTATION_COMMON (uint16)
|
468
|
+
Z_IMPLEMENTATION_REVERSE(uint16, 16, 1)
|
469
|
+
Z_IMPLEMENTATION_REVERSE(uint16, 16, 2)
|
470
|
+
Z_IMPLEMENTATION_REVERSE(uint16, 16, 4)
|
471
|
+
Z_IMPLEMENTATION_REVERSE(uint16, 16, 8)
|
472
|
+
Z_IMPLEMENTATION_ROTATE (uint16, 16)
|
473
|
+
|
474
|
+
|
475
|
+
#define z_uint16_reverse z_uint16_reverse_in_8bit
|
476
|
+
|
477
|
+
#if Z_UINT16_ENDIANNESS == Z_ENDIANNESS_BIG
|
478
|
+
|
479
|
+
# define z_uint16_big_endian Z_SAME
|
480
|
+
# define z_uint16_little_endian z_uint16_reverse
|
481
|
+
|
482
|
+
#elif Z_UINT16_ENDIANNESS == Z_ENDIANNESS_LITTLE
|
483
|
+
|
484
|
+
# define z_uint16_big_endian z_uint16_reverse
|
485
|
+
# define z_uint16_little_endian Z_SAME
|
486
|
+
|
487
|
+
#endif
|
488
|
+
|
489
|
+
|
490
|
+
static Z_INLINE
|
491
|
+
zboolean z_uint16_addition_overflows(zuint16 a, zuint16 b)
|
492
|
+
{return (zuint32)a + (zuint32)b > Z_UINT16_MAXIMUM;}
|
493
|
+
|
494
|
+
|
495
|
+
static Z_INLINE
|
496
|
+
zboolean z_uint16_addition_overflows_3(zuint16 a, zuint16 b, zuint16 c)
|
497
|
+
{return (zuint32)a + (zuint32)b + (zuint32)c > Z_UINT16_MAXIMUM;}
|
498
|
+
|
499
|
+
|
500
|
+
static Z_INLINE
|
501
|
+
zboolean z_uint16_addition_overflows_4(zuint16 a, zuint16 b, zuint16 c, zuint16 d)
|
502
|
+
{return (zuint32)a + (zuint32)b + (zuint32)c + (zuint32)d > Z_UINT16_MAXIMUM;}
|
503
|
+
|
504
|
+
|
505
|
+
static Z_INLINE
|
506
|
+
zboolean z_uint16_multiplication_overflows(zuint16 a, zuint16 b)
|
507
|
+
{return (zuint32)a * (zuint32)b > Z_UINT16_MAXIMUM;}
|
508
|
+
|
509
|
+
|
510
|
+
/*static Z_INLINE
|
511
|
+
zboolean z_uint16_multiplication_overflows_3(zuint16 a, zuint16 b, zuint16 c)
|
512
|
+
{return FALSE;}
|
513
|
+
|
514
|
+
|
515
|
+
static Z_INLINE
|
516
|
+
zboolean z_uint16_multiplication_overflows_4(zuint16 a, zuint16 b, zuint16 c, zuint16 d)
|
517
|
+
{return FALSE;}*/
|
518
|
+
|
519
|
+
|
520
|
+
static Z_INLINE
|
521
|
+
zboolean z_uint16_subtraction_overflows(zuint16 a, zuint16 b)
|
522
|
+
{return b > a;}
|
523
|
+
|
524
|
+
|
525
|
+
/*static Z_INLINE
|
526
|
+
zboolean z_uint16_subtraction_overflows_3(zuint16 a, zuint16 b, zuint16 c)
|
527
|
+
{return FALSE;}
|
528
|
+
|
529
|
+
|
530
|
+
static Z_INLINE
|
531
|
+
zboolean z_uint16_subtraction_overflows_4(zuint16 a, zuint16 b, zuint16 c, zuint16 d)
|
532
|
+
{return FALSE;}*/
|
533
|
+
|
534
|
+
|
535
|
+
static Z_INLINE
|
536
|
+
zuint8 z_uint16_minimum_storage_size(zuint16 value)
|
537
|
+
{return value >> 8 ? 2 : 1;}
|
538
|
+
|
539
|
+
|
540
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_ADD_THEN_GET)
|
541
|
+
# define z_uint16_atomic_add_then_get Z_COMPILER_FUNCTION(UINT16_ATOMIC_ADD_THEN_GET)
|
542
|
+
#endif
|
543
|
+
|
544
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_AND_THEN_GET)
|
545
|
+
# define z_uint16_atomic_and_then_get Z_COMPILER_FUNCTION(UINT16_ATOMIC_AND_THEN_GET)
|
546
|
+
#endif
|
547
|
+
|
548
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_DECREMENT_THEN_GET)
|
549
|
+
# define z_uint16_atomic_decrement_then_get Z_COMPILER_FUNCTION(UINT16_ATOMIC_DECREMENT_THEN_GET)
|
550
|
+
#endif
|
551
|
+
|
552
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_GET_THEN_ADD)
|
553
|
+
# define z_uint16_atomic_get_then_add Z_COMPILER_FUNCTION(UINT16_ATOMIC_GET_THEN_ADD)
|
554
|
+
#endif
|
555
|
+
|
556
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_GET_THEN_AND)
|
557
|
+
# define z_uint16_atomic_get_then_and Z_COMPILER_FUNCTION(UINT16_ATOMIC_GET_THEN_AND)
|
558
|
+
#endif
|
559
|
+
|
560
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_GET_THEN_DECREMENT)
|
561
|
+
# define z_uint16_atomic_get_then_decrement Z_COMPILER_FUNCTION(UINT16_ATOMIC_GET_THEN_DECREMENT)
|
562
|
+
#endif
|
563
|
+
|
564
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_GET_THEN_INCREMENT)
|
565
|
+
# define z_uint16_atomic_get_then_increment Z_COMPILER_FUNCTION(UINT16_ATOMIC_GET_THEN_INCREMENT)
|
566
|
+
#endif
|
567
|
+
|
568
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_GET_THEN_NAND)
|
569
|
+
# define z_uint16_atomic_get_then_nand Z_COMPILER_FUNCTION(UINT16_ATOMIC_GET_THEN_NAND)
|
570
|
+
#endif
|
571
|
+
|
572
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_GET_THEN_NOT)
|
573
|
+
# define z_uint16_atomic_get_then_not Z_COMPILER_FUNCTION(UINT16_ATOMIC_GET_THEN_NOT)
|
574
|
+
#endif
|
575
|
+
|
576
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_GET_THEN_OR)
|
577
|
+
# define z_uint16_atomic_get_then_or Z_COMPILER_FUNCTION(UINT16_ATOMIC_GET_THEN_OR)
|
578
|
+
#endif
|
579
|
+
|
580
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_GET_THEN_SET)
|
581
|
+
# define z_uint16_atomic_get_then_set Z_COMPILER_FUNCTION(UINT16_ATOMIC_GET_THEN_SET)
|
582
|
+
#endif
|
583
|
+
|
584
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_GET_THEN_SUBTRACT)
|
585
|
+
# define z_uint16_atomic_get_then_subtract Z_COMPILER_FUNCTION(UINT16_ATOMIC_GET_THEN_SUBTRACT)
|
586
|
+
#endif
|
587
|
+
|
588
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_GET_THEN_XOR)
|
589
|
+
# define z_uint16_atomic_get_then_xor Z_COMPILER_FUNCTION(UINT16_ATOMIC_GET_THEN_XOR)
|
590
|
+
#endif
|
591
|
+
|
592
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_INCREMENT_THEN_GET)
|
593
|
+
# define z_uint16_atomic_increment_then_get Z_COMPILER_FUNCTION(UINT16_ATOMIC_INCREMENT_THEN_GET)
|
594
|
+
#endif
|
595
|
+
|
596
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_NAND_THEN_GET)
|
597
|
+
# define z_uint16_atomic_nand_then_get Z_COMPILER_FUNCTION(UINT16_ATOMIC_NAND_THEN_GET)
|
598
|
+
#endif
|
599
|
+
|
600
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_NOT_THEN_GET)
|
601
|
+
# define z_uint16_atomic_not_then_get Z_COMPILER_FUNCTION(UINT16_ATOMIC_NOT_THEN_GET)
|
602
|
+
#endif
|
603
|
+
|
604
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_OR_THEN_GET)
|
605
|
+
# define z_uint16_atomic_or_then_get Z_COMPILER_FUNCTION(UINT16_ATOMIC_OR_THEN_GET)
|
606
|
+
#endif
|
607
|
+
|
608
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_SET_IF_EQUAL)
|
609
|
+
# define z_uint16_atomic_set_if_equal Z_COMPILER_FUNCTION(UINT16_ATOMIC_SET_IF_EQUAL)
|
610
|
+
#endif
|
611
|
+
|
612
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_SUBTRACT_THEN_GET)
|
613
|
+
# define z_uint16_atomic_subtract_then_get Z_COMPILER_FUNCTION(UINT16_ATOMIC_SUBTRACT_THEN_GET)
|
614
|
+
#endif
|
615
|
+
|
616
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT16_ATOMIC_XOR_THEN_GET)
|
617
|
+
# define z_uint16_atomic_xor_then_get Z_COMPILER_FUNCTION(UINT16_ATOMIC_XOR_THEN_GET)
|
618
|
+
#endif
|
619
|
+
|
620
|
+
|
621
|
+
/* MARK: - sint16 */
|
622
|
+
|
623
|
+
|
624
|
+
Z_IMPLEMENTATION_COMMON (sint16)
|
625
|
+
Z_IMPLEMENTATION_SIGNED (sint16)
|
626
|
+
Z_IMPLEMENTATION_REVERSE(sint16, 16, 1)
|
627
|
+
Z_IMPLEMENTATION_REVERSE(sint16, 16, 2)
|
628
|
+
Z_IMPLEMENTATION_REVERSE(sint16, 16, 4)
|
629
|
+
Z_IMPLEMENTATION_REVERSE(sint16, 16, 8)
|
630
|
+
Z_IMPLEMENTATION_ROTATE (sint16, 16)
|
631
|
+
|
632
|
+
|
633
|
+
#define z_sint16_reverse z_sint16_reverse_in_8bit
|
634
|
+
|
635
|
+
#if Z_SINT16_ENDIANNESS == Z_ENDIANNESS_BIG
|
636
|
+
|
637
|
+
# define z_sint16_big_endian Z_SAME
|
638
|
+
# define z_sint16_little_endian z_sint16_reverse
|
639
|
+
|
640
|
+
#elif Z_SINT16_ENDIANNESS == Z_ENDIANNESS_LITTLE
|
641
|
+
|
642
|
+
# define z_sint16_big_endian z_sint16_reverse
|
643
|
+
# define z_sint16_little_endian Z_SAME
|
644
|
+
|
645
|
+
#endif
|
646
|
+
|
647
|
+
|
648
|
+
/*static Z_INLINE
|
649
|
+
zboolean z_sint16_addition_overflows(zsint16 a, zsint16 b)
|
650
|
+
{return FALSE;}
|
651
|
+
|
652
|
+
|
653
|
+
static Z_INLINE
|
654
|
+
zboolean z_sint16_addition_overflows_3(zsint16 a, zsint16 b, zsint16 c)
|
655
|
+
{return FALSE;}
|
656
|
+
|
657
|
+
|
658
|
+
static Z_INLINE
|
659
|
+
zboolean z_sint16_addition_overflows_4(zsint16 a, zsint16 b, zsint16 c, zsint16 d)
|
660
|
+
{return FALSE;}
|
661
|
+
|
662
|
+
|
663
|
+
static Z_INLINE
|
664
|
+
zboolean z_sint16_multiplication_overflows(zsint16 a, zsint16 b)
|
665
|
+
{return FALSE;}
|
666
|
+
|
667
|
+
|
668
|
+
static Z_INLINE
|
669
|
+
zboolean z_sint16_multiplication_overflows_3(zsint16 a, zsint16 b, zsint16 c)
|
670
|
+
{return FALSE;}
|
671
|
+
|
672
|
+
|
673
|
+
static Z_INLINE
|
674
|
+
zboolean z_sint16_multiplication_overflows_4(zsint16 a, zsint16 b, zsint16 c, zsint16 d)
|
675
|
+
{return FALSE;}
|
676
|
+
|
677
|
+
|
678
|
+
static Z_INLINE
|
679
|
+
zboolean z_sint16_subtraction_overflows(zsint16 a, zsint16 b)
|
680
|
+
{return FALSE;}
|
681
|
+
|
682
|
+
|
683
|
+
static Z_INLINE
|
684
|
+
zboolean z_sint16_subtraction_overflows_3(zsint16 a, zsint16 b, zsint16 c)
|
685
|
+
{return FALSE;}
|
686
|
+
|
687
|
+
|
688
|
+
static Z_INLINE
|
689
|
+
zboolean z_sint16_subtraction_overflows_4(zsint16 a, zsint16 b, zsint16 c, zsint16 d)
|
690
|
+
{return FALSE;}*/
|
691
|
+
|
692
|
+
|
693
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_ADD_THEN_GET)
|
694
|
+
# define z_sint16_atomic_add_then_get Z_COMPILER_FUNCTION(SINT16_ATOMIC_ADD_THEN_GET)
|
695
|
+
#endif
|
696
|
+
|
697
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_AND_THEN_GET)
|
698
|
+
# define z_sint16_atomic_and_then_get Z_COMPILER_FUNCTION(SINT16_ATOMIC_AND_THEN_GET)
|
699
|
+
#endif
|
700
|
+
|
701
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_DECREMENT_THEN_GET)
|
702
|
+
# define z_sint16_atomic_decrement_then_get Z_COMPILER_FUNCTION(SINT16_ATOMIC_DECREMENT_THEN_GET)
|
703
|
+
#endif
|
704
|
+
|
705
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_GET_THEN_ADD)
|
706
|
+
# define z_sint16_atomic_get_then_add Z_COMPILER_FUNCTION(SINT16_ATOMIC_GET_THEN_ADD)
|
707
|
+
#endif
|
708
|
+
|
709
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_GET_THEN_AND)
|
710
|
+
# define z_sint16_atomic_get_then_and Z_COMPILER_FUNCTION(SINT16_ATOMIC_GET_THEN_AND)
|
711
|
+
#endif
|
712
|
+
|
713
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_GET_THEN_DECREMENT)
|
714
|
+
# define z_sint16_atomic_get_then_decrement Z_COMPILER_FUNCTION(SINT16_ATOMIC_GET_THEN_DECREMENT)
|
715
|
+
#endif
|
716
|
+
|
717
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_GET_THEN_INCREMENT)
|
718
|
+
# define z_sint16_atomic_get_then_increment Z_COMPILER_FUNCTION(SINT16_ATOMIC_GET_THEN_INCREMENT)
|
719
|
+
#endif
|
720
|
+
|
721
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_GET_THEN_NAND)
|
722
|
+
# define z_sint16_atomic_get_then_nand Z_COMPILER_FUNCTION(SINT16_ATOMIC_GET_THEN_NAND)
|
723
|
+
#endif
|
724
|
+
|
725
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_GET_THEN_NOT)
|
726
|
+
# define z_sint16_atomic_get_then_not Z_COMPILER_FUNCTION(SINT16_ATOMIC_GET_THEN_NOT)
|
727
|
+
#endif
|
728
|
+
|
729
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_GET_THEN_OR)
|
730
|
+
# define z_sint16_atomic_get_then_or Z_COMPILER_FUNCTION(SINT16_ATOMIC_GET_THEN_OR)
|
731
|
+
#endif
|
732
|
+
|
733
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_GET_THEN_SET)
|
734
|
+
# define z_sint16_atomic_get_then_set Z_COMPILER_FUNCTION(SINT16_ATOMIC_GET_THEN_SET)
|
735
|
+
#endif
|
736
|
+
|
737
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_GET_THEN_SUBTRACT)
|
738
|
+
# define z_sint16_atomic_get_then_subtract Z_COMPILER_FUNCTION(SINT16_ATOMIC_GET_THEN_SUBTRACT)
|
739
|
+
#endif
|
740
|
+
|
741
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_GET_THEN_XOR)
|
742
|
+
# define z_sint16_atomic_get_then_xor Z_COMPILER_FUNCTION(SINT16_ATOMIC_GET_THEN_XOR)
|
743
|
+
#endif
|
744
|
+
|
745
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_INCREMENT_THEN_GET)
|
746
|
+
# define z_sint16_atomic_increment_then_get Z_COMPILER_FUNCTION(SINT16_ATOMIC_INCREMENT_THEN_GET)
|
747
|
+
#endif
|
748
|
+
|
749
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_NAND_THEN_GET)
|
750
|
+
# define z_sint16_atomic_nand_then_get Z_COMPILER_FUNCTION(SINT16_ATOMIC_NAND_THEN_GET)
|
751
|
+
#endif
|
752
|
+
|
753
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_NOT_THEN_GET)
|
754
|
+
# define z_sint16_atomic_not_then_get Z_COMPILER_FUNCTION(SINT16_ATOMIC_NOT_THEN_GET)
|
755
|
+
#endif
|
756
|
+
|
757
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_OR_THEN_GET)
|
758
|
+
# define z_sint16_atomic_or_then_get Z_COMPILER_FUNCTION(SINT16_ATOMIC_OR_THEN_GET)
|
759
|
+
#endif
|
760
|
+
|
761
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_SET_IF_EQUAL)
|
762
|
+
# define z_sint16_atomic_set_if_equal Z_COMPILER_FUNCTION(SINT16_ATOMIC_SET_IF_EQUAL)
|
763
|
+
#endif
|
764
|
+
|
765
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_SUBTRACT_THEN_GET)
|
766
|
+
# define z_sint16_atomic_subtract_then_get Z_COMPILER_FUNCTION(SINT16_ATOMIC_SUBTRACT_THEN_GET)
|
767
|
+
#endif
|
768
|
+
|
769
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT16_ATOMIC_XOR_THEN_GET)
|
770
|
+
# define z_sint16_atomic_xor_then_get Z_COMPILER_FUNCTION(SINT16_ATOMIC_XOR_THEN_GET)
|
771
|
+
#endif
|
772
|
+
|
773
|
+
|
774
|
+
/* MARK: - uint32 */
|
775
|
+
|
776
|
+
|
777
|
+
Z_IMPLEMENTATION_COMMON (uint32)
|
778
|
+
Z_IMPLEMENTATION_REVERSE(uint32, 32, 1)
|
779
|
+
Z_IMPLEMENTATION_REVERSE(uint32, 32, 2)
|
780
|
+
Z_IMPLEMENTATION_REVERSE(uint32, 32, 4)
|
781
|
+
Z_IMPLEMENTATION_REVERSE(uint32, 32, 8)
|
782
|
+
Z_IMPLEMENTATION_REVERSE(uint32, 32, 16)
|
783
|
+
Z_IMPLEMENTATION_ROTATE (uint32, 32)
|
784
|
+
|
785
|
+
|
786
|
+
#define z_uint32_reverse z_uint32_reverse_in_8bit
|
787
|
+
|
788
|
+
#if Z_UINT32_ENDIANNESS == Z_ENDIANNESS_BIG
|
789
|
+
|
790
|
+
# define z_uint32_big_endian Z_SAME
|
791
|
+
# define z_uint32_little_endian z_uint32_reverse
|
792
|
+
|
793
|
+
#elif Z_UINT32_ENDIANNESS == Z_ENDIANNESS_LITTLE
|
794
|
+
|
795
|
+
# define z_uint32_big_endian z_uint32_reverse
|
796
|
+
# define z_uint32_little_endian Z_SAME
|
797
|
+
|
798
|
+
#endif
|
799
|
+
|
800
|
+
|
801
|
+
/*static Z_INLINE
|
802
|
+
zboolean z_uint32_addition_overflows(zuint32 a, zuint32 b)
|
803
|
+
{return FALSE;}
|
804
|
+
|
805
|
+
|
806
|
+
static Z_INLINE
|
807
|
+
zboolean z_uint32_addition_overflows_3(zuint32 a, zuint32 b, zuint32 c)
|
808
|
+
{return FALSE;}
|
809
|
+
|
810
|
+
|
811
|
+
static Z_INLINE
|
812
|
+
zboolean z_uint32_addition_overflows_4(zuint32 a, zuint32 b, zuint32 c, zuint32 d)
|
813
|
+
{return FALSE;}
|
814
|
+
|
815
|
+
|
816
|
+
static Z_INLINE
|
817
|
+
zboolean z_uint32_multiplication_overflows(zuint32 a, zuint32 b)
|
818
|
+
{return FALSE;}
|
819
|
+
|
820
|
+
|
821
|
+
static Z_INLINE
|
822
|
+
zboolean z_uint32_multiplication_overflows_3(zuint32 a, zuint32 b, zuint32 c)
|
823
|
+
{return FALSE;}
|
824
|
+
|
825
|
+
|
826
|
+
static Z_INLINE
|
827
|
+
zboolean z_uint32_multiplication_overflows_4(zuint32 a, zuint32 b, zuint32 c, zuint32 d)
|
828
|
+
{return FALSE;}
|
829
|
+
|
830
|
+
|
831
|
+
static Z_INLINE
|
832
|
+
zboolean z_uint32_subtraction_overflows(zuint32 a, zuint32 b)
|
833
|
+
{return b > a;}
|
834
|
+
|
835
|
+
|
836
|
+
static Z_INLINE
|
837
|
+
zboolean z_uint32_subtraction_overflows_3(zuint32 a, zuint32 b, zuint32 c)
|
838
|
+
{return FALSE;}
|
839
|
+
|
840
|
+
|
841
|
+
static Z_INLINE
|
842
|
+
zboolean z_uint32_subtraction_overflows_4(zuint32 a, zuint32 b, zuint32 c, zuint32 d)
|
843
|
+
{return FALSE;}*/
|
844
|
+
|
845
|
+
|
846
|
+
static Z_INLINE
|
847
|
+
zuint8 z_uint32_minimum_storage_size(zuint32 value)
|
848
|
+
{
|
849
|
+
if ((value >> 24)) return 4;
|
850
|
+
if ((value >> 16)) return 3;
|
851
|
+
if ((value >> 8)) return 2;
|
852
|
+
return 1;
|
853
|
+
}
|
854
|
+
|
855
|
+
|
856
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_ADD_THEN_GET)
|
857
|
+
# define z_uint32_atomic_add_then_get Z_COMPILER_FUNCTION(UINT32_ATOMIC_ADD_THEN_GET)
|
858
|
+
#endif
|
859
|
+
|
860
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_AND_THEN_GET)
|
861
|
+
# define z_uint32_atomic_and_then_get Z_COMPILER_FUNCTION(UINT32_ATOMIC_AND_THEN_GET)
|
862
|
+
#endif
|
863
|
+
|
864
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_DECREMENT_THEN_GET)
|
865
|
+
# define z_uint32_atomic_decrement_then_get Z_COMPILER_FUNCTION(UINT32_ATOMIC_DECREMENT_THEN_GET)
|
866
|
+
#endif
|
867
|
+
|
868
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_GET_THEN_ADD)
|
869
|
+
# define z_uint32_atomic_get_then_add Z_COMPILER_FUNCTION(UINT32_ATOMIC_GET_THEN_ADD)
|
870
|
+
#endif
|
871
|
+
|
872
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_GET_THEN_AND)
|
873
|
+
# define z_uint32_atomic_get_then_and Z_COMPILER_FUNCTION(UINT32_ATOMIC_GET_THEN_AND)
|
874
|
+
#endif
|
875
|
+
|
876
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_GET_THEN_DECREMENT)
|
877
|
+
# define z_uint32_atomic_get_then_decrement Z_COMPILER_FUNCTION(UINT32_ATOMIC_GET_THEN_DECREMENT)
|
878
|
+
#endif
|
879
|
+
|
880
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_GET_THEN_INCREMENT)
|
881
|
+
# define z_uint32_atomic_get_then_increment Z_COMPILER_FUNCTION(UINT32_ATOMIC_GET_THEN_INCREMENT)
|
882
|
+
#endif
|
883
|
+
|
884
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_GET_THEN_NAND)
|
885
|
+
# define z_uint32_atomic_get_then_nand Z_COMPILER_FUNCTION(UINT32_ATOMIC_GET_THEN_NAND)
|
886
|
+
#endif
|
887
|
+
|
888
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_GET_THEN_NOT)
|
889
|
+
# define z_uint32_atomic_get_then_not Z_COMPILER_FUNCTION(UINT32_ATOMIC_GET_THEN_NOT)
|
890
|
+
#endif
|
891
|
+
|
892
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_GET_THEN_OR)
|
893
|
+
# define z_uint32_atomic_get_then_or Z_COMPILER_FUNCTION(UINT32_ATOMIC_GET_THEN_OR)
|
894
|
+
#endif
|
895
|
+
|
896
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_GET_THEN_SET)
|
897
|
+
# define z_uint32_atomic_get_then_set Z_COMPILER_FUNCTION(UINT32_ATOMIC_GET_THEN_SET)
|
898
|
+
#endif
|
899
|
+
|
900
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_GET_THEN_SUBTRACT)
|
901
|
+
# define z_uint32_atomic_get_then_subtract Z_COMPILER_FUNCTION(UINT32_ATOMIC_GET_THEN_SUBTRACT)
|
902
|
+
#endif
|
903
|
+
|
904
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_GET_THEN_XOR)
|
905
|
+
# define z_uint32_atomic_get_then_xor Z_COMPILER_FUNCTION(UINT32_ATOMIC_GET_THEN_XOR)
|
906
|
+
#endif
|
907
|
+
|
908
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_INCREMENT_THEN_GET)
|
909
|
+
# define z_uint32_atomic_increment_then_get Z_COMPILER_FUNCTION(UINT32_ATOMIC_INCREMENT_THEN_GET)
|
910
|
+
#endif
|
911
|
+
|
912
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_NAND_THEN_GET)
|
913
|
+
# define z_uint32_atomic_nand_then_get Z_COMPILER_FUNCTION(UINT32_ATOMIC_NAND_THEN_GET)
|
914
|
+
#endif
|
915
|
+
|
916
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_NOT_THEN_GET)
|
917
|
+
# define z_uint32_atomic_not_then_get Z_COMPILER_FUNCTION(UINT32_ATOMIC_NOT_THEN_GET)
|
918
|
+
#endif
|
919
|
+
|
920
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_OR_THEN_GET)
|
921
|
+
# define z_uint32_atomic_or_then_get Z_COMPILER_FUNCTION(UINT32_ATOMIC_OR_THEN_GET)
|
922
|
+
#endif
|
923
|
+
|
924
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_SET_IF_EQUAL)
|
925
|
+
# define z_uint32_atomic_set_if_equal Z_COMPILER_FUNCTION(UINT32_ATOMIC_SET_IF_EQUAL)
|
926
|
+
#endif
|
927
|
+
|
928
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_SUBTRACT_THEN_GET)
|
929
|
+
# define z_uint32_atomic_subtract_then_get Z_COMPILER_FUNCTION(UINT32_ATOMIC_SUBTRACT_THEN_GET)
|
930
|
+
#endif
|
931
|
+
|
932
|
+
#if Z_COMPILER_HAS_FUNCTION(UINT32_ATOMIC_XOR_THEN_GET)
|
933
|
+
# define z_uint32_atomic_xor_then_get Z_COMPILER_FUNCTION(UINT32_ATOMIC_XOR_THEN_GET)
|
934
|
+
#endif
|
935
|
+
|
936
|
+
|
937
|
+
/* MARK: - sint32 */
|
938
|
+
|
939
|
+
|
940
|
+
Z_IMPLEMENTATION_COMMON (sint32)
|
941
|
+
Z_IMPLEMENTATION_SIGNED (sint32)
|
942
|
+
Z_IMPLEMENTATION_REVERSE(sint32, 32, 1)
|
943
|
+
Z_IMPLEMENTATION_REVERSE(sint32, 32, 2)
|
944
|
+
Z_IMPLEMENTATION_REVERSE(sint32, 32, 4)
|
945
|
+
Z_IMPLEMENTATION_REVERSE(sint32, 32, 8)
|
946
|
+
Z_IMPLEMENTATION_REVERSE(sint32, 32, 16)
|
947
|
+
Z_IMPLEMENTATION_ROTATE (sint32, 32)
|
948
|
+
|
949
|
+
|
950
|
+
#define z_sint32_reverse z_sint32_reverse_in_8bit
|
951
|
+
|
952
|
+
#if Z_SINT32_ENDIANNESS == Z_ENDIANNESS_BIG
|
953
|
+
|
954
|
+
# define z_sint32_big_endian Z_SAME
|
955
|
+
# define z_sint32_little_endian z_sint32_reverse
|
956
|
+
|
957
|
+
#elif Z_SINT32_ENDIANNESS == Z_ENDIANNESS_LITTLE
|
958
|
+
|
959
|
+
# define z_sint32_big_endian z_sint32_reverse
|
960
|
+
# define z_sint32_little_endian Z_SAME
|
961
|
+
|
962
|
+
#endif
|
963
|
+
|
964
|
+
|
965
|
+
/*static Z_INLINE
|
966
|
+
zboolean z_sint32_addition_overflows(zsint32 a, zsint32 b)
|
967
|
+
{return FALSE;}
|
968
|
+
|
969
|
+
|
970
|
+
static Z_INLINE
|
971
|
+
zboolean z_sint32_addition_overflows_3(zsint32 a, zsint32 b, zsint32 c)
|
972
|
+
{return FALSE;}
|
973
|
+
|
974
|
+
|
975
|
+
static Z_INLINE
|
976
|
+
zboolean z_sint32_addition_overflows_4(zsint32 a, zsint32 b, zsint32 c, zsint32 d)
|
977
|
+
{return FALSE;}
|
978
|
+
|
979
|
+
|
980
|
+
static Z_INLINE
|
981
|
+
zboolean z_sint32_multiplication_overflows(zsint32 a, zsint32 b)
|
982
|
+
{return FALSE;}
|
983
|
+
|
984
|
+
|
985
|
+
static Z_INLINE
|
986
|
+
zboolean z_sint32_multiplication_overflows_3(zsint32 a, zsint32 b, zsint32 c)
|
987
|
+
{return FALSE;}
|
988
|
+
|
989
|
+
|
990
|
+
static Z_INLINE
|
991
|
+
zboolean z_sint32_multiplication_overflows_4(zsint32 a, zsint32 b, zsint32 c, zsint32 d)
|
992
|
+
{return FALSE;}
|
993
|
+
|
994
|
+
|
995
|
+
static Z_INLINE
|
996
|
+
zboolean z_sint32_subtraction_overflows(zsint32 a, zsint32 b)
|
997
|
+
{return FALSE;}
|
998
|
+
|
999
|
+
|
1000
|
+
static Z_INLINE
|
1001
|
+
zboolean z_sint32_subtraction_overflows_3(zsint32 a, zsint32 b, zsint32 c)
|
1002
|
+
{return FALSE;}
|
1003
|
+
|
1004
|
+
|
1005
|
+
static Z_INLINE
|
1006
|
+
zboolean z_sint32_subtraction_overflows_4(zsint32 a, zsint32 b, zsint32 c, zsint32 d)
|
1007
|
+
{return FALSE;}*/
|
1008
|
+
|
1009
|
+
|
1010
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_ADD_THEN_GET)
|
1011
|
+
# define z_sint32_atomic_add_then_get Z_COMPILER_FUNCTION(SINT32_ATOMIC_ADD_THEN_GET)
|
1012
|
+
#endif
|
1013
|
+
|
1014
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_AND_THEN_GET)
|
1015
|
+
# define z_sint32_atomic_and_then_get Z_COMPILER_FUNCTION(SINT32_ATOMIC_AND_THEN_GET)
|
1016
|
+
#endif
|
1017
|
+
|
1018
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_DECREMENT_THEN_GET)
|
1019
|
+
# define z_sint32_atomic_decrement_then_get Z_COMPILER_FUNCTION(SINT32_ATOMIC_DECREMENT_THEN_GET)
|
1020
|
+
#endif
|
1021
|
+
|
1022
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_GET_THEN_ADD)
|
1023
|
+
# define z_sint32_atomic_get_then_add Z_COMPILER_FUNCTION(SINT32_ATOMIC_GET_THEN_ADD)
|
1024
|
+
#endif
|
1025
|
+
|
1026
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_GET_THEN_AND)
|
1027
|
+
# define z_sint32_atomic_get_then_and Z_COMPILER_FUNCTION(SINT32_ATOMIC_GET_THEN_AND)
|
1028
|
+
#endif
|
1029
|
+
|
1030
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_GET_THEN_DECREMENT)
|
1031
|
+
# define z_sint32_atomic_get_then_decrement Z_COMPILER_FUNCTION(SINT32_ATOMIC_GET_THEN_DECREMENT)
|
1032
|
+
#endif
|
1033
|
+
|
1034
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_GET_THEN_INCREMENT)
|
1035
|
+
# define z_sint32_atomic_get_then_increment Z_COMPILER_FUNCTION(SINT32_ATOMIC_GET_THEN_INCREMENT)
|
1036
|
+
#endif
|
1037
|
+
|
1038
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_GET_THEN_NAND)
|
1039
|
+
# define z_sint32_atomic_get_then_nand Z_COMPILER_FUNCTION(SINT32_ATOMIC_GET_THEN_NAND)
|
1040
|
+
#endif
|
1041
|
+
|
1042
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_GET_THEN_NOT)
|
1043
|
+
# define z_sint32_atomic_get_then_not Z_COMPILER_FUNCTION(SINT32_ATOMIC_GET_THEN_NOT)
|
1044
|
+
#endif
|
1045
|
+
|
1046
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_GET_THEN_OR)
|
1047
|
+
# define z_sint32_atomic_get_then_or Z_COMPILER_FUNCTION(SINT32_ATOMIC_GET_THEN_OR)
|
1048
|
+
#endif
|
1049
|
+
|
1050
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_GET_THEN_SET)
|
1051
|
+
# define z_sint32_atomic_get_then_set Z_COMPILER_FUNCTION(SINT32_ATOMIC_GET_THEN_SET)
|
1052
|
+
#endif
|
1053
|
+
|
1054
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_GET_THEN_SUBTRACT)
|
1055
|
+
# define z_sint32_atomic_get_then_subtract Z_COMPILER_FUNCTION(SINT32_ATOMIC_GET_THEN_SUBTRACT)
|
1056
|
+
#endif
|
1057
|
+
|
1058
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_GET_THEN_XOR)
|
1059
|
+
# define z_sint32_atomic_get_then_xor Z_COMPILER_FUNCTION(SINT32_ATOMIC_GET_THEN_XOR)
|
1060
|
+
#endif
|
1061
|
+
|
1062
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_INCREMENT_THEN_GET)
|
1063
|
+
# define z_sint32_atomic_increment_then_get Z_COMPILER_FUNCTION(SINT32_ATOMIC_INCREMENT_THEN_GET)
|
1064
|
+
#endif
|
1065
|
+
|
1066
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_NAND_THEN_GET)
|
1067
|
+
# define z_sint32_atomic_nand_then_get Z_COMPILER_FUNCTION(SINT32_ATOMIC_NAND_THEN_GET)
|
1068
|
+
#endif
|
1069
|
+
|
1070
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_NOT_THEN_GET)
|
1071
|
+
# define z_sint32_atomic_not_then_get Z_COMPILER_FUNCTION(SINT32_ATOMIC_NOT_THEN_GET)
|
1072
|
+
#endif
|
1073
|
+
|
1074
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_OR_THEN_GET)
|
1075
|
+
# define z_sint32_atomic_or_then_get Z_COMPILER_FUNCTION(SINT32_ATOMIC_OR_THEN_GET)
|
1076
|
+
#endif
|
1077
|
+
|
1078
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_SET_IF_EQUAL)
|
1079
|
+
# define z_sint32_atomic_set_if_equal Z_COMPILER_FUNCTION(SINT32_ATOMIC_SET_IF_EQUAL)
|
1080
|
+
#endif
|
1081
|
+
|
1082
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_SUBTRACT_THEN_GET)
|
1083
|
+
# define z_sint32_atomic_subtract_then_get Z_COMPILER_FUNCTION(SINT32_ATOMIC_SUBTRACT_THEN_GET)
|
1084
|
+
#endif
|
1085
|
+
|
1086
|
+
#if Z_COMPILER_HAS_FUNCTION(SINT32_ATOMIC_XOR_THEN_GET)
|
1087
|
+
# define z_sint32_atomic_xor_then_get Z_COMPILER_FUNCTION(SINT32_ATOMIC_XOR_THEN_GET)
|
1088
|
+
#endif
|
1089
|
+
|
1090
|
+
|
1091
|
+
/* MARK: - uint64 */
|
1092
|
+
|
1093
|
+
|
1094
|
+
#ifdef Z_UINT64
|
1095
|
+
|
1096
|
+
Z_IMPLEMENTATION_COMMON (uint64)
|
1097
|
+
Z_IMPLEMENTATION_REVERSE(uint64, 64, 1)
|
1098
|
+
Z_IMPLEMENTATION_REVERSE(uint64, 64, 2)
|
1099
|
+
Z_IMPLEMENTATION_REVERSE(uint64, 64, 4)
|
1100
|
+
Z_IMPLEMENTATION_REVERSE(uint64, 64, 8)
|
1101
|
+
Z_IMPLEMENTATION_REVERSE(uint64, 64, 16)
|
1102
|
+
Z_IMPLEMENTATION_REVERSE(uint64, 64, 32)
|
1103
|
+
Z_IMPLEMENTATION_ROTATE (uint64, 64)
|
1104
|
+
|
1105
|
+
|
1106
|
+
# define z_uint64_reverse z_uint64_reverse_in_8bit
|
1107
|
+
|
1108
|
+
# if Z_UINT64_ENDIANNESS == Z_ENDIANNESS_BIG
|
1109
|
+
|
1110
|
+
# define z_uint64_big_endian Z_SAME
|
1111
|
+
# define z_uint64_little_endian z_uint64_reverse
|
1112
|
+
|
1113
|
+
# elif Z_UINT64_ENDIANNESS == Z_ENDIANNESS_LITTLE
|
1114
|
+
|
1115
|
+
# define z_uint64_big_endian z_uint64_reverse
|
1116
|
+
# define z_uint64_little_endian Z_SAME
|
1117
|
+
|
1118
|
+
# endif
|
1119
|
+
|
1120
|
+
|
1121
|
+
/*static Z_INLINE
|
1122
|
+
zboolean z_uint64_addition_overflows(zuint64 a, zuint64 b)
|
1123
|
+
{return FALSE;}
|
1124
|
+
|
1125
|
+
|
1126
|
+
static Z_INLINE
|
1127
|
+
zboolean z_uint64_addition_overflows_3(zuint64 a, zuint64 b, zuint64 c)
|
1128
|
+
{return FALSE;}
|
1129
|
+
|
1130
|
+
|
1131
|
+
static Z_INLINE
|
1132
|
+
zboolean z_uint64_addition_overflows_4(zuint64 a, zuint64 b, zuint64 c, zuint64 d)
|
1133
|
+
{return FALSE;}
|
1134
|
+
|
1135
|
+
|
1136
|
+
static Z_INLINE
|
1137
|
+
zboolean z_uint64_multiplication_overflows(zuint64 a, zuint64 b)
|
1138
|
+
{return FALSE;}
|
1139
|
+
|
1140
|
+
static Z_INLINE
|
1141
|
+
zboolean z_uint64_multiplication_overflows_3(zuint64 a, zuint64 b, zuint64 c)
|
1142
|
+
{return FALSE;}
|
1143
|
+
|
1144
|
+
|
1145
|
+
static Z_INLINE
|
1146
|
+
zboolean z_uint64_multiplication_overflows_4(zuint64 a, zuint64 b, zuint64 c, zuint64 d)
|
1147
|
+
{return FALSE;}
|
1148
|
+
|
1149
|
+
|
1150
|
+
static Z_INLINE
|
1151
|
+
zboolean z_uint64_subtraction_overflows(zuint64 a, zuint64 b)
|
1152
|
+
{return b > a;}
|
1153
|
+
|
1154
|
+
|
1155
|
+
static Z_INLINE
|
1156
|
+
zboolean z_uint64_subtraction_overflows_3(zuint64 a, zuint64 b, zuint64 c)
|
1157
|
+
{return FALSE;}
|
1158
|
+
|
1159
|
+
|
1160
|
+
static Z_INLINE
|
1161
|
+
zboolean z_uint64_subtraction_overflows_4(zuint64 a, zuint64 b, zuint64 c, zuint64 d)
|
1162
|
+
{return FALSE;}*/
|
1163
|
+
|
1164
|
+
|
1165
|
+
static Z_INLINE
|
1166
|
+
zuint8 z_uint64_minimum_storage_size(zuint64 value)
|
1167
|
+
{
|
1168
|
+
if ((value >> 56)) return 8;
|
1169
|
+
if ((value >> 48)) return 7;
|
1170
|
+
if ((value >> 40)) return 6;
|
1171
|
+
if ((value >> 32)) return 5;
|
1172
|
+
if ((value >> 24)) return 4;
|
1173
|
+
if ((value >> 16)) return 3;
|
1174
|
+
if ((value >> 8)) return 2;
|
1175
|
+
return 1;
|
1176
|
+
}
|
1177
|
+
|
1178
|
+
|
1179
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_ADD_THEN_GET)
|
1180
|
+
# define z_uint64_atomic_add_then_get Z_COMPILER_FUNCTION(UINT64_ATOMIC_ADD_THEN_GET)
|
1181
|
+
# endif
|
1182
|
+
|
1183
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_AND_THEN_GET)
|
1184
|
+
# define z_uint64_atomic_and_then_get Z_COMPILER_FUNCTION(UINT64_ATOMIC_AND_THEN_GET)
|
1185
|
+
# endif
|
1186
|
+
|
1187
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_DECREMENT_THEN_GET)
|
1188
|
+
# define z_uint64_atomic_decrement_then_get Z_COMPILER_FUNCTION(UINT64_ATOMIC_DECREMENT_THEN_GET)
|
1189
|
+
# endif
|
1190
|
+
|
1191
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_GET_THEN_ADD)
|
1192
|
+
# define z_uint64_atomic_get_then_add Z_COMPILER_FUNCTION(UINT64_ATOMIC_GET_THEN_ADD)
|
1193
|
+
# endif
|
1194
|
+
|
1195
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_GET_THEN_AND)
|
1196
|
+
# define z_uint64_atomic_get_then_and Z_COMPILER_FUNCTION(UINT64_ATOMIC_GET_THEN_AND)
|
1197
|
+
# endif
|
1198
|
+
|
1199
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_GET_THEN_DECREMENT)
|
1200
|
+
# define z_uint64_atomic_get_then_decrement Z_COMPILER_FUNCTION(UINT64_ATOMIC_GET_THEN_DECREMENT)
|
1201
|
+
# endif
|
1202
|
+
|
1203
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_GET_THEN_INCREMENT)
|
1204
|
+
# define z_uint64_atomic_get_then_increment Z_COMPILER_FUNCTION(UINT64_ATOMIC_GET_THEN_INCREMENT)
|
1205
|
+
# endif
|
1206
|
+
|
1207
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_GET_THEN_NAND)
|
1208
|
+
# define z_uint64_atomic_get_then_nand Z_COMPILER_FUNCTION(UINT64_ATOMIC_GET_THEN_NAND)
|
1209
|
+
# endif
|
1210
|
+
|
1211
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_GET_THEN_NOT)
|
1212
|
+
# define z_uint64_atomic_get_then_not Z_COMPILER_FUNCTION(UINT64_ATOMIC_GET_THEN_NOT)
|
1213
|
+
# endif
|
1214
|
+
|
1215
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_GET_THEN_OR)
|
1216
|
+
# define z_uint64_atomic_get_then_or Z_COMPILER_FUNCTION(UINT64_ATOMIC_GET_THEN_OR)
|
1217
|
+
# endif
|
1218
|
+
|
1219
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_GET_THEN_SET)
|
1220
|
+
# define z_uint64_atomic_get_then_set Z_COMPILER_FUNCTION(UINT64_ATOMIC_GET_THEN_SET)
|
1221
|
+
# endif
|
1222
|
+
|
1223
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_GET_THEN_SUBTRACT)
|
1224
|
+
# define z_uint64_atomic_get_then_subtract Z_COMPILER_FUNCTION(UINT64_ATOMIC_GET_THEN_SUBTRACT)
|
1225
|
+
# endif
|
1226
|
+
|
1227
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_GET_THEN_XOR)
|
1228
|
+
# define z_uint64_atomic_get_then_xor Z_COMPILER_FUNCTION(UINT64_ATOMIC_GET_THEN_XOR)
|
1229
|
+
# endif
|
1230
|
+
|
1231
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_INCREMENT_THEN_GET)
|
1232
|
+
# define z_uint64_atomic_increment_then_get Z_COMPILER_FUNCTION(UINT64_ATOMIC_INCREMENT_THEN_GET)
|
1233
|
+
# endif
|
1234
|
+
|
1235
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_NAND_THEN_GET)
|
1236
|
+
# define z_uint64_atomic_nand_then_get Z_COMPILER_FUNCTION(UINT64_ATOMIC_NAND_THEN_GET)
|
1237
|
+
# endif
|
1238
|
+
|
1239
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_NOT_THEN_GET)
|
1240
|
+
# define z_uint64_atomic_not_then_get Z_COMPILER_FUNCTION(UINT64_ATOMIC_NOT_THEN_GET)
|
1241
|
+
# endif
|
1242
|
+
|
1243
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_OR_THEN_GET)
|
1244
|
+
# define z_uint64_atomic_or_then_get Z_COMPILER_FUNCTION(UINT64_ATOMIC_OR_THEN_GET)
|
1245
|
+
# endif
|
1246
|
+
|
1247
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_SET_IF_EQUAL)
|
1248
|
+
# define z_uint64_atomic_set_if_equal Z_COMPILER_FUNCTION(UINT64_ATOMIC_SET_IF_EQUAL)
|
1249
|
+
# endif
|
1250
|
+
|
1251
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_SUBTRACT_THEN_GET)
|
1252
|
+
# define z_uint64_atomic_subtract_then_get Z_COMPILER_FUNCTION(UINT64_ATOMIC_SUBTRACT_THEN_GET)
|
1253
|
+
# endif
|
1254
|
+
|
1255
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT64_ATOMIC_XOR_THEN_GET)
|
1256
|
+
# define z_uint64_atomic_xor_then_get Z_COMPILER_FUNCTION(UINT64_ATOMIC_XOR_THEN_GET)
|
1257
|
+
# endif
|
1258
|
+
|
1259
|
+
#endif
|
1260
|
+
|
1261
|
+
|
1262
|
+
/* MARK: - sint64 */
|
1263
|
+
|
1264
|
+
|
1265
|
+
#ifdef Z_SINT64
|
1266
|
+
|
1267
|
+
Z_IMPLEMENTATION_COMMON (sint64)
|
1268
|
+
Z_IMPLEMENTATION_SIGNED (sint64)
|
1269
|
+
Z_IMPLEMENTATION_REVERSE(sint64, 64, 1)
|
1270
|
+
Z_IMPLEMENTATION_REVERSE(sint64, 64, 2)
|
1271
|
+
Z_IMPLEMENTATION_REVERSE(sint64, 64, 4)
|
1272
|
+
Z_IMPLEMENTATION_REVERSE(sint64, 64, 8)
|
1273
|
+
Z_IMPLEMENTATION_REVERSE(sint64, 64, 16)
|
1274
|
+
Z_IMPLEMENTATION_REVERSE(sint64, 64, 32)
|
1275
|
+
Z_IMPLEMENTATION_ROTATE (sint64, 64)
|
1276
|
+
|
1277
|
+
|
1278
|
+
# define z_sint64_reverse z_sint64_reverse_in_8bit
|
1279
|
+
|
1280
|
+
# if Z_SINT64_ENDIANNESS == Z_ENDIANNESS_BIG
|
1281
|
+
|
1282
|
+
# define z_sint64_big_endian Z_SAME
|
1283
|
+
# define z_sint64_little_endian z_sint64_reverse
|
1284
|
+
|
1285
|
+
# elif Z_SINT64_ENDIANNESS == Z_ENDIANNESS_LITTLE
|
1286
|
+
|
1287
|
+
# define z_sint64_big_endian z_sint64_reverse
|
1288
|
+
# define z_sint64_little_endian Z_SAME
|
1289
|
+
|
1290
|
+
# endif
|
1291
|
+
|
1292
|
+
|
1293
|
+
/*static Z_INLINE
|
1294
|
+
zboolean z_sint64_addition_overflows(zsint64 a, zsint64 b)
|
1295
|
+
{return FALSE;}
|
1296
|
+
|
1297
|
+
|
1298
|
+
static Z_INLINE
|
1299
|
+
zboolean z_sint64_addition_overflows_3(zsint64 a, zsint64 b, zsint64 c)
|
1300
|
+
{return FALSE;}
|
1301
|
+
|
1302
|
+
|
1303
|
+
static Z_INLINE
|
1304
|
+
zboolean z_sint64_addition_overflows_4(zsint64 a, zsint64 b, zsint64 c, zsint64 d)
|
1305
|
+
{return FALSE;}
|
1306
|
+
|
1307
|
+
|
1308
|
+
static Z_INLINE
|
1309
|
+
zboolean z_sint64_multiplication_overflows(zsint64 a, zsint64 b)
|
1310
|
+
{return FALSE;}
|
1311
|
+
|
1312
|
+
|
1313
|
+
static Z_INLINE
|
1314
|
+
zboolean z_sint64_multiplication_overflows_3(zsint64 a, zsint64 b, zsint64 c)
|
1315
|
+
{return FALSE;}
|
1316
|
+
|
1317
|
+
|
1318
|
+
static Z_INLINE
|
1319
|
+
zboolean z_sint64_multiplication_overflows_4(zsint64 a, zsint64 b, zsint64 c, zsint64 d)
|
1320
|
+
{return FALSE;}
|
1321
|
+
|
1322
|
+
|
1323
|
+
static Z_INLINE
|
1324
|
+
zboolean z_sint64_subtraction_overflows(zsint64 a, zsint64 b)
|
1325
|
+
{return FALSE;}
|
1326
|
+
|
1327
|
+
|
1328
|
+
static Z_INLINE
|
1329
|
+
zboolean z_sint64_subtraction_overflows_3(zsint64 a, zsint64 b, zsint64 c)
|
1330
|
+
{return FALSE;}
|
1331
|
+
|
1332
|
+
|
1333
|
+
static Z_INLINE
|
1334
|
+
zboolean z_sint64_subtraction_overflows_4(zsint64 a, zsint64 b, zsint64 c, zsint64 d)
|
1335
|
+
{return FALSE;}*/
|
1336
|
+
|
1337
|
+
|
1338
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_ADD_THEN_GET)
|
1339
|
+
# define z_sint64_atomic_add_then_get Z_COMPILER_FUNCTION(SINT64_ATOMIC_ADD_THEN_GET)
|
1340
|
+
# endif
|
1341
|
+
|
1342
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_AND_THEN_GET)
|
1343
|
+
# define z_sint64_atomic_and_then_get Z_COMPILER_FUNCTION(SINT64_ATOMIC_AND_THEN_GET)
|
1344
|
+
# endif
|
1345
|
+
|
1346
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_DECREMENT_THEN_GET)
|
1347
|
+
# define z_sint64_atomic_decrement_then_get Z_COMPILER_FUNCTION(SINT64_ATOMIC_DECREMENT_THEN_GET)
|
1348
|
+
# endif
|
1349
|
+
|
1350
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_GET_THEN_ADD)
|
1351
|
+
# define z_sint64_atomic_get_then_add Z_COMPILER_FUNCTION(SINT64_ATOMIC_GET_THEN_ADD)
|
1352
|
+
# endif
|
1353
|
+
|
1354
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_GET_THEN_AND)
|
1355
|
+
# define z_sint64_atomic_get_then_and Z_COMPILER_FUNCTION(SINT64_ATOMIC_GET_THEN_AND)
|
1356
|
+
# endif
|
1357
|
+
|
1358
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_GET_THEN_DECREMENT)
|
1359
|
+
# define z_sint64_atomic_get_then_decrement Z_COMPILER_FUNCTION(SINT64_ATOMIC_GET_THEN_DECREMENT)
|
1360
|
+
# endif
|
1361
|
+
|
1362
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_GET_THEN_INCREMENT)
|
1363
|
+
# define z_sint64_atomic_get_then_increment Z_COMPILER_FUNCTION(SINT64_ATOMIC_GET_THEN_INCREMENT)
|
1364
|
+
# endif
|
1365
|
+
|
1366
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_GET_THEN_NAND)
|
1367
|
+
# define z_sint64_atomic_get_then_nand Z_COMPILER_FUNCTION(SINT64_ATOMIC_GET_THEN_NAND)
|
1368
|
+
# endif
|
1369
|
+
|
1370
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_GET_THEN_NOT)
|
1371
|
+
# define z_sint64_atomic_get_then_not Z_COMPILER_FUNCTION(SINT64_ATOMIC_GET_THEN_NOT)
|
1372
|
+
# endif
|
1373
|
+
|
1374
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_GET_THEN_OR)
|
1375
|
+
# define z_sint64_atomic_get_then_or Z_COMPILER_FUNCTION(SINT64_ATOMIC_GET_THEN_OR)
|
1376
|
+
# endif
|
1377
|
+
|
1378
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_GET_THEN_SET)
|
1379
|
+
# define z_sint64_atomic_get_then_set Z_COMPILER_FUNCTION(SINT64_ATOMIC_GET_THEN_SET)
|
1380
|
+
# endif
|
1381
|
+
|
1382
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_GET_THEN_SUBTRACT)
|
1383
|
+
# define z_sint64_atomic_get_then_subtract Z_COMPILER_FUNCTION(SINT64_ATOMIC_GET_THEN_SUBTRACT)
|
1384
|
+
# endif
|
1385
|
+
|
1386
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_GET_THEN_XOR)
|
1387
|
+
# define z_sint64_atomic_get_then_xor Z_COMPILER_FUNCTION(SINT64_ATOMIC_GET_THEN_XOR)
|
1388
|
+
# endif
|
1389
|
+
|
1390
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_INCREMENT_THEN_GET)
|
1391
|
+
# define z_sint64_atomic_increment_then_get Z_COMPILER_FUNCTION(SINT64_ATOMIC_INCREMENT_THEN_GET)
|
1392
|
+
# endif
|
1393
|
+
|
1394
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_NAND_THEN_GET)
|
1395
|
+
# define z_sint64_atomic_nand_then_get Z_COMPILER_FUNCTION(SINT64_ATOMIC_NAND_THEN_GET)
|
1396
|
+
# endif
|
1397
|
+
|
1398
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_NOT_THEN_GET)
|
1399
|
+
# define z_sint64_atomic_not_then_get Z_COMPILER_FUNCTION(SINT64_ATOMIC_NOT_THEN_GET)
|
1400
|
+
# endif
|
1401
|
+
|
1402
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_OR_THEN_GET)
|
1403
|
+
# define z_sint64_atomic_or_then_get Z_COMPILER_FUNCTION(SINT64_ATOMIC_OR_THEN_GET)
|
1404
|
+
# endif
|
1405
|
+
|
1406
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_SET_IF_EQUAL)
|
1407
|
+
# define z_sint64_atomic_set_if_equal Z_COMPILER_FUNCTION(SINT64_ATOMIC_SET_IF_EQUAL)
|
1408
|
+
# endif
|
1409
|
+
|
1410
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_SUBTRACT_THEN_GET)
|
1411
|
+
# define z_sint64_atomic_subtract_then_get Z_COMPILER_FUNCTION(SINT64_ATOMIC_SUBTRACT_THEN_GET)
|
1412
|
+
# endif
|
1413
|
+
|
1414
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT64_ATOMIC_XOR_THEN_GET)
|
1415
|
+
# define z_sint64_atomic_xor_then_get Z_COMPILER_FUNCTION(SINT64_ATOMIC_XOR_THEN_GET)
|
1416
|
+
# endif
|
1417
|
+
|
1418
|
+
#endif
|
1419
|
+
|
1420
|
+
|
1421
|
+
/* MARK: - uint128 */
|
1422
|
+
|
1423
|
+
|
1424
|
+
#ifdef Z_UINT128
|
1425
|
+
|
1426
|
+
Z_IMPLEMENTATION_COMMON (uint128)
|
1427
|
+
Z_IMPLEMENTATION_REVERSE(uint128, 128, 1)
|
1428
|
+
Z_IMPLEMENTATION_REVERSE(uint128, 128, 2)
|
1429
|
+
Z_IMPLEMENTATION_REVERSE(uint128, 128, 4)
|
1430
|
+
Z_IMPLEMENTATION_REVERSE(uint128, 128, 8)
|
1431
|
+
Z_IMPLEMENTATION_REVERSE(uint128, 128, 16)
|
1432
|
+
Z_IMPLEMENTATION_REVERSE(uint128, 128, 32)
|
1433
|
+
Z_IMPLEMENTATION_REVERSE(uint128, 128, 64)
|
1434
|
+
Z_IMPLEMENTATION_ROTATE (uint128, 128)
|
1435
|
+
|
1436
|
+
|
1437
|
+
# define z_uint128_reverse z_uint128_reverse_in_8bit
|
1438
|
+
|
1439
|
+
# if Z_UINT128_ENDIANNESS == Z_ENDIANNESS_BIG
|
1440
|
+
|
1441
|
+
# define z_uint128_big_endian Z_SAME
|
1442
|
+
# define z_uint128_little_endian z_uint128_reverse
|
1443
|
+
|
1444
|
+
# elif Z_UINT128_ENDIANNESS == Z_ENDIANNESS_LITTLE
|
1445
|
+
|
1446
|
+
# define z_uint128_big_endian z_uint128_reverse
|
1447
|
+
# define z_uint128_little_endian Z_SAME
|
1448
|
+
|
1449
|
+
# endif
|
1450
|
+
|
1451
|
+
|
1452
|
+
/*static Z_INLINE
|
1453
|
+
zboolean z_uint128_addition_overflows(zuint128 a, zuint128 b)
|
1454
|
+
{return FALSE;}
|
1455
|
+
|
1456
|
+
|
1457
|
+
static Z_INLINE
|
1458
|
+
zboolean z_uint128_addition_overflows_3(zuint128 a, zuint128 b, zuint128 c)
|
1459
|
+
{return FALSE;}
|
1460
|
+
|
1461
|
+
|
1462
|
+
static Z_INLINE
|
1463
|
+
zboolean z_uint128_addition_overflows_4(zuint128 a, zuint128 b, zuint128 c, zuint128 d)
|
1464
|
+
{return FALSE;}
|
1465
|
+
|
1466
|
+
|
1467
|
+
static Z_INLINE
|
1468
|
+
zboolean z_uint128_multiplication_overflows(zuint128 a, zuint128 b)
|
1469
|
+
{return FALSE;}
|
1470
|
+
|
1471
|
+
|
1472
|
+
static Z_INLINE
|
1473
|
+
zboolean z_uint128_multiplication_overflows_3(zuint128 a, zuint128 b, zuint128 c)
|
1474
|
+
{return FALSE;}
|
1475
|
+
|
1476
|
+
|
1477
|
+
static Z_INLINE
|
1478
|
+
zboolean z_uint128_multiplication_overflows_4(zuint128 a, zuint128 b, zuint128 c, zuint128 d)
|
1479
|
+
{return FALSE;}
|
1480
|
+
|
1481
|
+
|
1482
|
+
static Z_INLINE
|
1483
|
+
zboolean z_uint128_subtraction_overflows(zuint128 a, zuint128 b)
|
1484
|
+
{return b > a;}
|
1485
|
+
|
1486
|
+
|
1487
|
+
static Z_INLINE
|
1488
|
+
zboolean z_uint128_subtraction_overflows_3(zuint128 a, zuint128 b, zuint128 c)
|
1489
|
+
{return FALSE;}
|
1490
|
+
|
1491
|
+
|
1492
|
+
static Z_INLINE
|
1493
|
+
zboolean z_uint128_subtraction_overflows_4(zuint128 a, zuint128 b, zuint128 c, zuint128 d)
|
1494
|
+
{return FALSE;}*/
|
1495
|
+
|
1496
|
+
|
1497
|
+
static Z_INLINE
|
1498
|
+
zuint8 z_uint128_minimum_storage_size(zuint128 value)
|
1499
|
+
{
|
1500
|
+
if ((value >> 120)) return 16;
|
1501
|
+
if ((value >> 112)) return 15;
|
1502
|
+
if ((value >> 104)) return 14;
|
1503
|
+
if ((value >> 96)) return 13;
|
1504
|
+
if ((value >> 88)) return 12;
|
1505
|
+
if ((value >> 80)) return 11;
|
1506
|
+
if ((value >> 72)) return 10;
|
1507
|
+
if ((value >> 64)) return 9;
|
1508
|
+
if ((value >> 56)) return 8;
|
1509
|
+
if ((value >> 48)) return 7;
|
1510
|
+
if ((value >> 40)) return 6;
|
1511
|
+
if ((value >> 32)) return 5;
|
1512
|
+
if ((value >> 24)) return 4;
|
1513
|
+
if ((value >> 16)) return 3;
|
1514
|
+
if ((value >> 8)) return 2;
|
1515
|
+
return 1;
|
1516
|
+
}
|
1517
|
+
|
1518
|
+
|
1519
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_ADD_THEN_GET)
|
1520
|
+
# define z_uint128_atomic_add_then_get Z_COMPILER_FUNCTION(UINT128_ATOMIC_ADD_THEN_GET)
|
1521
|
+
# endif
|
1522
|
+
|
1523
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_AND_THEN_GET)
|
1524
|
+
# define z_uint128_atomic_and_then_get Z_COMPILER_FUNCTION(UINT128_ATOMIC_AND_THEN_GET)
|
1525
|
+
# endif
|
1526
|
+
|
1527
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_DECREMENT_THEN_GET)
|
1528
|
+
# define z_uint128_atomic_decrement_then_get Z_COMPILER_FUNCTION(UINT128_ATOMIC_DECREMENT_THEN_GET)
|
1529
|
+
# endif
|
1530
|
+
|
1531
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_GET_THEN_ADD)
|
1532
|
+
# define z_uint128_atomic_get_then_add Z_COMPILER_FUNCTION(UINT128_ATOMIC_GET_THEN_ADD)
|
1533
|
+
# endif
|
1534
|
+
|
1535
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_GET_THEN_AND)
|
1536
|
+
# define z_uint128_atomic_get_then_and Z_COMPILER_FUNCTION(UINT128_ATOMIC_GET_THEN_AND)
|
1537
|
+
# endif
|
1538
|
+
|
1539
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_GET_THEN_DECREMENT)
|
1540
|
+
# define z_uint128_atomic_get_then_decrement Z_COMPILER_FUNCTION(UINT128_ATOMIC_GET_THEN_DECREMENT)
|
1541
|
+
# endif
|
1542
|
+
|
1543
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_GET_THEN_INCREMENT)
|
1544
|
+
# define z_uint128_atomic_get_then_increment Z_COMPILER_FUNCTION(UINT128_ATOMIC_GET_THEN_INCREMENT)
|
1545
|
+
# endif
|
1546
|
+
|
1547
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_GET_THEN_NAND)
|
1548
|
+
# define z_uint128_atomic_get_then_nand Z_COMPILER_FUNCTION(UINT128_ATOMIC_GET_THEN_NAND)
|
1549
|
+
# endif
|
1550
|
+
|
1551
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_GET_THEN_NOT)
|
1552
|
+
# define z_uint128_atomic_get_then_not Z_COMPILER_FUNCTION(UINT128_ATOMIC_GET_THEN_NOT)
|
1553
|
+
# endif
|
1554
|
+
|
1555
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_GET_THEN_OR)
|
1556
|
+
# define z_uint128_atomic_get_then_or Z_COMPILER_FUNCTION(UINT128_ATOMIC_GET_THEN_OR)
|
1557
|
+
# endif
|
1558
|
+
|
1559
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_GET_THEN_SET)
|
1560
|
+
# define z_uint128_atomic_get_then_set Z_COMPILER_FUNCTION(UINT128_ATOMIC_GET_THEN_SET)
|
1561
|
+
# endif
|
1562
|
+
|
1563
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_GET_THEN_SUBTRACT)
|
1564
|
+
# define z_uint128_atomic_get_then_subtract Z_COMPILER_FUNCTION(UINT128_ATOMIC_GET_THEN_SUBTRACT)
|
1565
|
+
# endif
|
1566
|
+
|
1567
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_GET_THEN_XOR)
|
1568
|
+
# define z_uint128_atomic_get_then_xor Z_COMPILER_FUNCTION(UINT128_ATOMIC_GET_THEN_XOR)
|
1569
|
+
# endif
|
1570
|
+
|
1571
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_INCREMENT_THEN_GET)
|
1572
|
+
# define z_uint128_atomic_increment_then_get Z_COMPILER_FUNCTION(UINT128_ATOMIC_INCREMENT_THEN_GET)
|
1573
|
+
# endif
|
1574
|
+
|
1575
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_NAND_THEN_GET)
|
1576
|
+
# define z_uint128_atomic_nand_then_get Z_COMPILER_FUNCTION(UINT128_ATOMIC_NAND_THEN_GET)
|
1577
|
+
# endif
|
1578
|
+
|
1579
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_NOT_THEN_GET)
|
1580
|
+
# define z_uint128_atomic_not_then_get Z_COMPILER_FUNCTION(UINT128_ATOMIC_NOT_THEN_GET)
|
1581
|
+
# endif
|
1582
|
+
|
1583
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_OR_THEN_GET)
|
1584
|
+
# define z_uint128_atomic_or_then_get Z_COMPILER_FUNCTION(UINT128_ATOMIC_OR_THEN_GET)
|
1585
|
+
# endif
|
1586
|
+
|
1587
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_SET_IF_EQUAL)
|
1588
|
+
# define z_uint128_atomic_set_if_equal Z_COMPILER_FUNCTION(UINT128_ATOMIC_SET_IF_EQUAL)
|
1589
|
+
# endif
|
1590
|
+
|
1591
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_SUBTRACT_THEN_GET)
|
1592
|
+
# define z_uint128_atomic_subtract_then_get Z_COMPILER_FUNCTION(UINT128_ATOMIC_SUBTRACT_THEN_GET)
|
1593
|
+
# endif
|
1594
|
+
|
1595
|
+
# if Z_COMPILER_HAS_FUNCTION(UINT128_ATOMIC_XOR_THEN_GET)
|
1596
|
+
# define z_uint128_atomic_xor_then_get Z_COMPILER_FUNCTION(UINT128_ATOMIC_XOR_THEN_GET)
|
1597
|
+
# endif
|
1598
|
+
|
1599
|
+
#endif
|
1600
|
+
|
1601
|
+
|
1602
|
+
/* MARK: - sint128 */
|
1603
|
+
|
1604
|
+
|
1605
|
+
#ifdef Z_SINT128
|
1606
|
+
|
1607
|
+
Z_IMPLEMENTATION_COMMON (sint128)
|
1608
|
+
Z_IMPLEMENTATION_SIGNED (sint128)
|
1609
|
+
Z_IMPLEMENTATION_REVERSE(sint128, 128, 1)
|
1610
|
+
Z_IMPLEMENTATION_REVERSE(sint128, 128, 2)
|
1611
|
+
Z_IMPLEMENTATION_REVERSE(sint128, 128, 4)
|
1612
|
+
Z_IMPLEMENTATION_REVERSE(sint128, 128, 8)
|
1613
|
+
Z_IMPLEMENTATION_REVERSE(sint128, 128, 16)
|
1614
|
+
Z_IMPLEMENTATION_REVERSE(sint128, 128, 32)
|
1615
|
+
Z_IMPLEMENTATION_REVERSE(sint128, 128, 64)
|
1616
|
+
Z_IMPLEMENTATION_ROTATE (sint128, 128)
|
1617
|
+
|
1618
|
+
|
1619
|
+
# define z_sint128_reverse z_sint128_reverse_in_8bit
|
1620
|
+
|
1621
|
+
# if Z_SINT128_ENDIANNESS == Z_ENDIANNESS_BIG
|
1622
|
+
|
1623
|
+
# define z_sint128_big_endian Z_SAME
|
1624
|
+
# define z_sint128_little_endian z_sint128_reverse
|
1625
|
+
|
1626
|
+
# elif Z_SINT128_ENDIANNESS == Z_ENDIANNESS_LITTLE
|
1627
|
+
|
1628
|
+
# define z_sint128_big_endian z_sint128_reverse
|
1629
|
+
# define z_sint128_little_endian Z_SAME
|
1630
|
+
|
1631
|
+
# endif
|
1632
|
+
|
1633
|
+
|
1634
|
+
/*static Z_INLINE
|
1635
|
+
zboolean z_sint128_addition_overflows(zsint128 a, zsint128 b)
|
1636
|
+
{return FALSE;}
|
1637
|
+
|
1638
|
+
|
1639
|
+
static Z_INLINE
|
1640
|
+
zboolean z_sint128_addition_overflows_3(zsint128 a, zsint128 b, zsint128 c)
|
1641
|
+
{return FALSE;}
|
1642
|
+
|
1643
|
+
|
1644
|
+
static Z_INLINE
|
1645
|
+
zboolean z_sint128_addition_overflows_4(zsint128 a, zsint128 b, zsint128 c, zsint128 d)
|
1646
|
+
{return FALSE;}
|
1647
|
+
|
1648
|
+
|
1649
|
+
static Z_INLINE
|
1650
|
+
zboolean z_sint128_multiplication_overflows(zsint128 a, zsint128 b)
|
1651
|
+
{return FALSE;}
|
1652
|
+
|
1653
|
+
|
1654
|
+
static Z_INLINE
|
1655
|
+
zboolean z_sint128_multiplication_overflows_3(zsint128 a, zsint128 b, zsint128 c)
|
1656
|
+
{return FALSE;}
|
1657
|
+
|
1658
|
+
|
1659
|
+
static Z_INLINE
|
1660
|
+
zboolean z_sint128_multiplication_overflows_4(zsint128 a, zsint128 b, zsint128 c, zsint128 d)
|
1661
|
+
{return FALSE;}
|
1662
|
+
|
1663
|
+
|
1664
|
+
static Z_INLINE
|
1665
|
+
zboolean z_sint128_subtraction_overflows(zsint128 a, zsint128 b)
|
1666
|
+
{return FALSE;}
|
1667
|
+
|
1668
|
+
|
1669
|
+
static Z_INLINE
|
1670
|
+
zboolean z_sint128_subtraction_overflows_3(zsint128 a, zsint128 b, zsint128 c)
|
1671
|
+
{return FALSE;}
|
1672
|
+
|
1673
|
+
|
1674
|
+
static Z_INLINE
|
1675
|
+
zboolean z_sint128_subtraction_overflows_4(zsint128 a, zsint128 b, zsint128 c, zsint128 d)
|
1676
|
+
{return FALSE;}*/
|
1677
|
+
|
1678
|
+
|
1679
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_ADD_THEN_GET)
|
1680
|
+
# define z_sint128_atomic_add_then_get Z_COMPILER_FUNCTION(SINT128_ATOMIC_ADD_THEN_GET)
|
1681
|
+
# endif
|
1682
|
+
|
1683
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_AND_THEN_GET)
|
1684
|
+
# define z_sint128_atomic_and_then_get Z_COMPILER_FUNCTION(SINT128_ATOMIC_AND_THEN_GET)
|
1685
|
+
# endif
|
1686
|
+
|
1687
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_DECREMENT_THEN_GET)
|
1688
|
+
# define z_sint128_atomic_decrement_then_get Z_COMPILER_FUNCTION(SINT128_ATOMIC_DECREMENT_THEN_GET)
|
1689
|
+
# endif
|
1690
|
+
|
1691
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_GET_THEN_ADD)
|
1692
|
+
# define z_sint128_atomic_get_then_add Z_COMPILER_FUNCTION(SINT128_ATOMIC_GET_THEN_ADD)
|
1693
|
+
# endif
|
1694
|
+
|
1695
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_GET_THEN_AND)
|
1696
|
+
# define z_sint128_atomic_get_then_and Z_COMPILER_FUNCTION(SINT128_ATOMIC_GET_THEN_AND)
|
1697
|
+
# endif
|
1698
|
+
|
1699
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_GET_THEN_DECREMENT)
|
1700
|
+
# define z_sint128_atomic_get_then_decrement Z_COMPILER_FUNCTION(SINT128_ATOMIC_GET_THEN_DECREMENT)
|
1701
|
+
# endif
|
1702
|
+
|
1703
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_GET_THEN_INCREMENT)
|
1704
|
+
# define z_sint128_atomic_get_then_increment Z_COMPILER_FUNCTION(SINT128_ATOMIC_GET_THEN_INCREMENT)
|
1705
|
+
# endif
|
1706
|
+
|
1707
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_GET_THEN_NAND)
|
1708
|
+
# define z_sint128_atomic_get_then_nand Z_COMPILER_FUNCTION(SINT128_ATOMIC_GET_THEN_NAND)
|
1709
|
+
# endif
|
1710
|
+
|
1711
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_GET_THEN_NOT)
|
1712
|
+
# define z_sint128_atomic_get_then_not Z_COMPILER_FUNCTION(SINT128_ATOMIC_GET_THEN_NOT)
|
1713
|
+
# endif
|
1714
|
+
|
1715
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_GET_THEN_OR)
|
1716
|
+
# define z_sint128_atomic_get_then_or Z_COMPILER_FUNCTION(SINT128_ATOMIC_GET_THEN_OR)
|
1717
|
+
# endif
|
1718
|
+
|
1719
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_GET_THEN_SET)
|
1720
|
+
# define z_sint128_atomic_get_then_set Z_COMPILER_FUNCTION(SINT128_ATOMIC_GET_THEN_SET)
|
1721
|
+
# endif
|
1722
|
+
|
1723
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_GET_THEN_SUBTRACT)
|
1724
|
+
# define z_sint128_atomic_get_then_subtract Z_COMPILER_FUNCTION(SINT128_ATOMIC_GET_THEN_SUBTRACT)
|
1725
|
+
# endif
|
1726
|
+
|
1727
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_GET_THEN_XOR)
|
1728
|
+
# define z_sint128_atomic_get_then_xor Z_COMPILER_FUNCTION(SINT128_ATOMIC_GET_THEN_XOR)
|
1729
|
+
# endif
|
1730
|
+
|
1731
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_INCREMENT_THEN_GET)
|
1732
|
+
# define z_sint128_atomic_increment_then_get Z_COMPILER_FUNCTION(SINT128_ATOMIC_INCREMENT_THEN_GET)
|
1733
|
+
# endif
|
1734
|
+
|
1735
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_NAND_THEN_GET)
|
1736
|
+
# define z_sint128_atomic_nand_then_get Z_COMPILER_FUNCTION(SINT128_ATOMIC_NAND_THEN_GET)
|
1737
|
+
# endif
|
1738
|
+
|
1739
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_NOT_THEN_GET)
|
1740
|
+
# define z_sint128_atomic_not_then_get Z_COMPILER_FUNCTION(SINT128_ATOMIC_NOT_THEN_GET)
|
1741
|
+
# endif
|
1742
|
+
|
1743
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_OR_THEN_GET)
|
1744
|
+
# define z_sint128_atomic_or_then_get Z_COMPILER_FUNCTION(SINT128_ATOMIC_OR_THEN_GET)
|
1745
|
+
# endif
|
1746
|
+
|
1747
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_SET_IF_EQUAL)
|
1748
|
+
# define z_sint128_atomic_set_if_equal Z_COMPILER_FUNCTION(SINT128_ATOMIC_SET_IF_EQUAL)
|
1749
|
+
# endif
|
1750
|
+
|
1751
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_SUBTRACT_THEN_GET)
|
1752
|
+
# define z_sint128_atomic_subtract_then_get Z_COMPILER_FUNCTION(SINT128_ATOMIC_SUBTRACT_THEN_GET)
|
1753
|
+
# endif
|
1754
|
+
|
1755
|
+
# if Z_COMPILER_HAS_FUNCTION(SINT128_ATOMIC_XOR_THEN_GET)
|
1756
|
+
# define z_sint128_atomic_xor_then_get Z_COMPILER_FUNCTION(SINT128_ATOMIC_XOR_THEN_GET)
|
1757
|
+
# endif
|
1758
|
+
|
1759
|
+
#endif
|
1760
|
+
|
1761
|
+
|
1762
|
+
/* MARK: - float16 */
|
1763
|
+
|
1764
|
+
|
1765
|
+
#ifdef Z_FLOAT16
|
1766
|
+
Z_IMPLEMENTATION_COMMON(float16)
|
1767
|
+
Z_IMPLEMENTATION_SIGNED(float16)
|
1768
|
+
Z_IMPLEMENTATION_REAL (float16, Z_FLOAT16, Z_FLOAT16_EPSILON, Z_FLOAT16_INFINITY)
|
1769
|
+
#endif
|
1770
|
+
|
1771
|
+
|
1772
|
+
/* MARK: - float32 */
|
1773
|
+
|
1774
|
+
|
1775
|
+
#ifdef Z_FLOAT32
|
1776
|
+
Z_IMPLEMENTATION_COMMON(float32)
|
1777
|
+
Z_IMPLEMENTATION_SIGNED(float32)
|
1778
|
+
Z_IMPLEMENTATION_REAL (float32, Z_FLOAT32, Z_FLOAT32_EPSILON, Z_FLOAT32_INFINITY)
|
1779
|
+
#endif
|
1780
|
+
|
1781
|
+
/* MARK: - float64 */
|
1782
|
+
|
1783
|
+
|
1784
|
+
#ifdef Z_FLOAT64
|
1785
|
+
Z_IMPLEMENTATION_COMMON(float64)
|
1786
|
+
Z_IMPLEMENTATION_SIGNED(float64)
|
1787
|
+
Z_IMPLEMENTATION_REAL (float64, Z_FLOAT64, Z_FLOAT64_EPSILON, Z_FLOAT64_INFINITY)
|
1788
|
+
#endif
|
1789
|
+
|
1790
|
+
|
1791
|
+
/* MARK: - float128 */
|
1792
|
+
|
1793
|
+
|
1794
|
+
#ifdef Z_FLOAT128
|
1795
|
+
Z_IMPLEMENTATION_COMMON(float128)
|
1796
|
+
Z_IMPLEMENTATION_SIGNED(float128)
|
1797
|
+
Z_IMPLEMENTATION_REAL (float128, Z_FLOAT128, Z_FLOAT128_EPSILON, Z_FLOAT128_INFINITY)
|
1798
|
+
#endif
|
1799
|
+
|
1800
|
+
|
1801
|
+
/* MARK: - float80_x87 */
|
1802
|
+
|
1803
|
+
|
1804
|
+
#ifdef Z_FLOAT80_X87
|
1805
|
+
Z_IMPLEMENTATION_COMMON(float80_x87)
|
1806
|
+
Z_IMPLEMENTATION_SIGNED(float80_x87)
|
1807
|
+
Z_IMPLEMENTATION_REAL (float80_x87, Z_FLOAT80_X87, Z_FLOAT80_X87_EPSILON, Z_FLOAT80_X87_INFINITY)
|
1808
|
+
#endif
|
1809
|
+
|
1810
|
+
|
1811
|
+
/* MARK: - float96_x87 */
|
1812
|
+
|
1813
|
+
|
1814
|
+
#ifdef Z_FLOAT96_X87
|
1815
|
+
Z_IMPLEMENTATION_COMMON(float96_x87)
|
1816
|
+
Z_IMPLEMENTATION_SIGNED(float96_x87)
|
1817
|
+
Z_IMPLEMENTATION_REAL (float96_x87, Z_FLOAT96_X87, Z_FLOAT96_X87_EPSILON, Z_FLOAT96_X87_INFINITY)
|
1818
|
+
#endif
|
1819
|
+
|
1820
|
+
|
1821
|
+
/* MARK: - float128_x87 */
|
1822
|
+
|
1823
|
+
|
1824
|
+
#ifdef Z_FLOAT128_X87
|
1825
|
+
Z_IMPLEMENTATION_COMMON(float128_x87)
|
1826
|
+
Z_IMPLEMENTATION_SIGNED(float128_x87)
|
1827
|
+
Z_IMPLEMENTATION_REAL (float128_x87, Z_FLOAT128_X87, Z_FLOAT128_X87_EPSILON, Z_FLOAT128_X87_INFINITY)
|
1828
|
+
#endif
|
1829
|
+
|
1830
|
+
|
1831
|
+
/* MARK: - Cleanup */
|
1832
|
+
|
1833
|
+
|
1834
|
+
#undef Z_IMPLEMENTATION_COMMON
|
1835
|
+
#undef Z_IMPLEMENTATION_SIGNED
|
1836
|
+
#undef Z_IMPLEMENTATION_REAL
|
1837
|
+
#undef Z_IMPLEMENTATION_REVERSE
|
1838
|
+
#undef Z_IMPLEMENTATION_ROTATE
|
1839
|
+
|
1840
|
+
|
1841
|
+
/* MARK: - Function selectors */
|
1842
|
+
|
1843
|
+
|
1844
|
+
#define z_type_addition_overflows( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _addition_overflows )
|
1845
|
+
#define z_type_addition_overflows_3( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _addition_overflows_3 )
|
1846
|
+
#define z_type_addition_overflows_4( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _addition_overflows_4 )
|
1847
|
+
#define z_type_atomic_add_then_get( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _atomic_add_then_get )
|
1848
|
+
#define z_type_atomic_and_then_get( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _atomic_and_then_get )
|
1849
|
+
#define z_type_atomic_decrement_then_get( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _atomic_decrement_then_get)
|
1850
|
+
#define z_type_atomic_get_then_add( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _atomic_get_then_add )
|
1851
|
+
#define z_type_atomic_get_then_and( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _atomic_get_then_and )
|
1852
|
+
#define z_type_atomic_get_then_decrement( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _atomic_get_then_decrement)
|
1853
|
+
#define z_type_atomic_get_then_increment( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _atomic_get_then_increment)
|
1854
|
+
#define z_type_atomic_get_then_nand( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _atomic_get_then_nand )
|
1855
|
+
#define z_type_atomic_get_then_not( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _atomic_get_then_not )
|
1856
|
+
#define z_type_atomic_get_then_or( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _atomic_get_then_or )
|
1857
|
+
#define z_type_atomic_get_then_set( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _atomic_get_then_set )
|
1858
|
+
#define z_type_atomic_get_then_subtract( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _atomic_get_then_subtract )
|
1859
|
+
#define z_type_atomic_get_then_xor( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _atomic_get_then_xor )
|
1860
|
+
#define z_type_atomic_increment_then_get( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _atomic_increment_then_get)
|
1861
|
+
#define z_type_atomic_nand_then_get( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _atomic_nand_then_get )
|
1862
|
+
#define z_type_atomic_not_then_get( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _atomic_not_then_get )
|
1863
|
+
#define z_type_atomic_or_then_get( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _atomic_or_then_get )
|
1864
|
+
#define z_type_atomic_set_if_equal( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _atomic_set_if_equal )
|
1865
|
+
#define z_type_atomic_subtract_then_get( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _atomic_subtract_then_get )
|
1866
|
+
#define z_type_atomic_xor_then_get( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _atomic_xor_then_get )
|
1867
|
+
#define z_type_big_endian( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _big_endian )
|
1868
|
+
#define z_type_little_endian( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _little_endian )
|
1869
|
+
#define z_type_minimum_storage_size( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _minimum_storage_size )
|
1870
|
+
#define z_type_multiplication_overflows( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _addition_overflows )
|
1871
|
+
#define z_type_multiplication_overflows_3(TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _addition_overflows_3 )
|
1872
|
+
#define z_type_multiplication_overflows_4(TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _addition_overflows_4 )
|
1873
|
+
#define z_type_subtraction_overflows( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _subtraction_overflows )
|
1874
|
+
#define z_type_subtraction_overflows_3( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _subtraction_overflows_3 )
|
1875
|
+
#define z_type_subtraction_overflows_4( TYPE) Z_INSERT_##TYPE##_fixed_type(z_, _subtraction_overflows_4 )
|
1876
|
+
|
1877
|
+
|
1878
|
+
/* MARK: - Default real type definitions */
|
1879
|
+
|
1880
|
+
|
1881
|
+
#ifdef Z_REAL
|
1882
|
+
# define z_absolute z_type_absolute (REAL)
|
1883
|
+
# define z_are_almost_equal z_type_are_almost_equal(REAL)
|
1884
|
+
# define z_clamp z_type_clamp (REAL)
|
1885
|
+
# define z_clamp_01 z_type_clamp_01 (REAL)
|
1886
|
+
# define z_inverse_lerp z_type_inverse_lerp (REAL)
|
1887
|
+
# define z_is_almost_zero z_type_is_almost_zero (REAL)
|
1888
|
+
# define z_is_finite z_type_is_finite (REAL)
|
1889
|
+
# define z_is_infinity z_type_is_infinity (REAL)
|
1890
|
+
# define z_is_nan z_type_is_nan (REAL)
|
1891
|
+
# define z_lerp z_type_lerp (REAL)
|
1892
|
+
# define z_maximum z_type_maximum (REAL)
|
1893
|
+
# define z_minimum z_type_minimum (REAL)
|
1894
|
+
# define z_sign z_type_sign (REAL)
|
1895
|
+
# define z_sign_or_zero z_type_sign_or_zero (REAL)
|
1896
|
+
# define z_smootherstep z_type_smootherstep (REAL)
|
1897
|
+
# define z_smoothstep z_type_smoothstep (REAL)
|
1898
|
+
#endif
|
1899
|
+
|
1900
|
+
|
1901
|
+
#endif /* _Z_functions_base_value_H_ */
|