From df42c435f62528c1b7ae7ca3b8f8d2afa7196045 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 5 Feb 2013 10:25:42 +0000 Subject: write double/float via union with unsigned type for strict-aliasing Change-Id: Ie4dd1d41e5cde27ec5b144ca4b7c97276ff62479 Reviewed-on: https://gerrit.libreoffice.org/1990 Reviewed-by: David Ostrovsky Tested-by: David Ostrovsky --- registry/tools/reg2bin.cxx | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'registry') diff --git a/registry/tools/reg2bin.cxx b/registry/tools/reg2bin.cxx index be8fead9bdc4..5983b5629937 100644 --- a/registry/tools/reg2bin.cxx +++ b/registry/tools/reg2bin.cxx @@ -1196,6 +1196,7 @@ sal_uInt64 writeMap( static_cast< sal_uInt32 >(j->second.constantValue.l)); break; case CONSTANT_TYPE_UNSIGNED_LONG: + case CONSTANT_TYPE_FLOAT: //access through union for strict-aliasing write32(file, j->second.constantValue.ul); break; case CONSTANT_TYPE_HYPER: @@ -1204,20 +1205,9 @@ sal_uInt64 writeMap( static_cast< sal_uInt64 >(j->second.constantValue.h)); break; case CONSTANT_TYPE_UNSIGNED_HYPER: + case CONSTANT_TYPE_DOUBLE: //access through union for strict-aliasing write64(file, j->second.constantValue.uh); break; - case CONSTANT_TYPE_FLOAT: - write32( - file, - *reinterpret_cast< sal_uInt32 const * >( - &j->second.constantValue.f)); - break; - case CONSTANT_TYPE_DOUBLE: - write64( - file, - *reinterpret_cast< sal_uInt64 const * >( - &j->second.constantValue.d)); - break; default: std::abort(); // this cannot happen } -- cgit