diff options
author | Noel Grandin <noel@peralex.com> | 2021-01-06 10:29:07 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-01-06 10:44:34 +0100 |
commit | 9b36cae4ca95ab9508752f2a13a45d09c3dbd87f (patch) | |
tree | b859c067796f167e875d7d371381078f8eb0a4c6 | |
parent | 40281e6c5b0147ea3aa2deb862f83f502b4c79dc (diff) |
use anonymous union for BigInt
since we only use one or the other of these fields.
Change-Id: Ib9cb4895028420a74d0a65d6cd934b0f56f203a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108833
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/tools/bigint.hxx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/include/tools/bigint.hxx b/include/tools/bigint.hxx index a8d8575fb53b..53f681609ecf 100644 --- a/include/tools/bigint.hxx +++ b/include/tools/bigint.hxx @@ -28,8 +28,11 @@ class SAL_WARN_UNUSED TOOLS_DLLPUBLIC BigInt { private: - sal_Int32 nVal; - sal_uInt16 nNum[MAX_DIGITS]; + // we only use one of these two fields at a time + union { + sal_Int32 nVal; + sal_uInt16 nNum[MAX_DIGITS]; + }; sal_uInt8 nLen : 5; // current length bool bIsNeg : 1, // Is Sign negative? bIsBig : 1; // if true , value is in nNum array |