summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-11-12 09:31:42 +0100
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-11-13 13:38:26 +0100
commitd55e0fbde49ad3b1e678419588dd58df6d9e06c4 (patch)
tree4c448d5a759829f4e7b6e5e594db83dd3a926009 /include
parent811b77e0f63b91eeb05311c724e3e209bff30f68 (diff)
Revert "remove BigInt::operator tools::Long()"
This reverts commit 1397a1c8e4995b0dd336478e564880fe8ad91d1d. Reason for revert: Some discussion required Change-Id: Id39ee8260790e0722c5bf8338b0b76ca34da83d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105539 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r--include/editeng/itemtype.hxx2
-rw-r--r--include/tools/bigint.hxx14
2 files changed, 15 insertions, 1 deletions
diff --git a/include/editeng/itemtype.hxx b/include/editeng/itemtype.hxx
index 9adcb98cb370..19d2a19b4ee3 100644
--- a/include/editeng/itemtype.hxx
+++ b/include/editeng/itemtype.hxx
@@ -42,7 +42,7 @@ inline tools::Long Scale( tools::Long nVal, tools::Long nMult, tools::Long nDiv
aVal *= nMult;
aVal += nDiv/2;
aVal /= nDiv;
- return static_cast<sal_Int32>(aVal);
+ return aVal;
}
#endif
diff --git a/include/tools/bigint.hxx b/include/tools/bigint.hxx
index 6683f07e3121..db8c3bcd1b1c 100644
--- a/include/tools/bigint.hxx
+++ b/include/tools/bigint.hxx
@@ -88,6 +88,9 @@ public:
operator sal_Int32() const;
operator sal_uInt32() const;
operator double() const;
+#if SAL_TYPES_SIZEOFPOINTER == 8
+ operator tools::Long() const;
+#endif
bool IsSet() const { return bIsSet; }
bool IsNeg() const;
@@ -153,6 +156,17 @@ inline BigInt::operator sal_uInt32() const
return 0;
}
+#if SAL_TYPES_SIZEOFPOINTER == 8
+inline BigInt::operator tools::Long() const
+{
+ // Clamp to int32 since long is int32 on Windows.
+ if (!bIsBig)
+ return nVal;
+ assert(false && "out of range");
+ return 0;
+}
+#endif
+
inline BigInt& BigInt::operator =( sal_Int32 nValue )
{
bIsSet = true;