summaryrefslogtreecommitdiff
path: root/include/vcl/checksum.hxx
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2015-08-27 22:57:15 +0200
committerMichael Meeks <michael.meeks@collabora.com>2015-09-01 16:28:46 +0100
commit209951a8ae71ae38d57457a5a85005be8f46dcdf (patch)
tree9bab49617fc392444cc74753d53312531cbe676f /include/vcl/checksum.hxx
parentb545728fddad2e70b6a38515b60455fc229e63af (diff)
switch to 64-bit checksum: conversion from BitmapChecksum to an octet array
Defined BitmapChecksumOctetArray which is an array of bytes whose size is the same of BitmapChecksum. Defined a routine for converting a BitmapChecksum into a BitmapChecksumOctetArray. Change-Id: I70d17ab8b841795ae27c60b418d6b090bff604bb
Diffstat (limited to 'include/vcl/checksum.hxx')
-rw-r--r--include/vcl/checksum.hxx21
1 files changed, 19 insertions, 2 deletions
diff --git a/include/vcl/checksum.hxx b/include/vcl/checksum.hxx
index 2987fdae4cc0..83facefd6c9e 100644
--- a/include/vcl/checksum.hxx
+++ b/include/vcl/checksum.hxx
@@ -26,6 +26,11 @@
#include <sal/types.h>
#include <tools/solar.h>
+#include <boost/preprocessor/arithmetic/inc.hpp>
+#include <boost/preprocessor/arithmetic/mul.hpp>
+#include <boost/preprocessor/repetition/repeat_from_to.hpp>
+
+
/*========================================================================
*
* vcl_crc64Table (CRC polynomial 0x95AC9329AC4BC9B5ULL).
@@ -120,9 +125,21 @@ static const sal_uInt64 vcl_crc64Table[256] = {
0x29b7d047efec8728ULL
};
-typedef sal_uLong BitmapChecksum;
+#define BITMAP_CHECKSUM_SIZE 4
+#define BITMAP_CHECKSUM_BITS BOOST_PP_MUL(BITMAP_CHECKSUM_SIZE, 8)
+
+typedef sal_uLong BitmapChecksum;
+
+typedef sal_uInt8 BitmapChecksumOctetArray[BITMAP_CHECKSUM_SIZE];
-#define BITMAP_CHECKSUM_BITS (sizeof(BitmapChecksum) * 8)
+#define BITMAP_CHECKSUM_SET_OCTET(z, i, unused) \
+p[i] = (sal_uInt8)(n >> BOOST_PP_MUL(8, i));
+
+
+inline void BCToBCOA( BitmapChecksum n , BitmapChecksumOctetArray p )
+{
+ BOOST_PP_REPEAT(BITMAP_CHECKSUM_SIZE , BITMAP_CHECKSUM_SET_OCTET, unused)
+}
#ifdef __cplusplus
extern "C" {