LibreOffice Module vcl (master) 1
checksum.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20
21#ifndef INCLUDED_VCL_INC_CHECKSUM_HXX
22#define INCLUDED_VCL_INC_CHECKSUM_HXX
23
24#include <sal/config.h>
25#include <sal/types.h>
26#include <vcl/dllapi.h>
27
28#define BITMAP_CHECKSUM_SIZE 8
29
30typedef sal_uInt64 BitmapChecksum;
32
33template< sal_uInt8 N = 0 >
35{
36 p[N] = static_cast<sal_uInt8>(n >> ( 8 * N ));
37 return BCToBCOA< N + 1 >( n, p );
38}
39
40template<>
42{
43 return;
44}
45
46extern "C" {
47
48/*========================================================================
49 *
50 * vcl_crc64 interface.
51 *
52 *======================================================================*/
62VCL_DLLPUBLIC sal_uInt64 vcl_crc64 (
63 sal_uInt64 Crc,
64 const void *Data, sal_uInt32 DatLen
66
67
68const sal_uInt64* vcl_get_crc64_table();
69
70}
71
73 BitmapChecksum Checksum,
74 const void *Data,
75 sal_uInt32 DatLen
76)
77{
78 return static_cast<BitmapChecksum>(vcl_crc64( Checksum, Data, DatLen ));
79}
80
81
82#endif // INCLUDED_VCL_INC_CHECKSUM_HXX
83
84/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define BITMAP_CHECKSUM_SIZE
Definition: checksum.hxx:28
const sal_uInt64 * vcl_get_crc64_table()
Definition: checksum.cxx:149
sal_uInt8 BitmapChecksumOctetArray[BITMAP_CHECKSUM_SIZE]
Definition: checksum.hxx:31
sal_uInt64 BitmapChecksum
Definition: checksum.hxx:30
void BCToBCOA(BitmapChecksum n, BitmapChecksumOctetArray p)
Definition: checksum.hxx:34
VCL_DLLPUBLIC sal_uInt64 vcl_crc64(sal_uInt64 Crc, const void *Data, sal_uInt32 DatLen) SAL_THROW_EXTERN_C()
Evaluate CRC64 over given data.
Definition: checksum.cxx:129
void BCToBCOA< BITMAP_CHECKSUM_SIZE >(BitmapChecksum, BitmapChecksumOctetArray)
Definition: checksum.hxx:41
BitmapChecksum vcl_get_checksum(BitmapChecksum Checksum, const void *Data, sal_uInt32 DatLen)
Definition: checksum.hxx:72
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
void * p
sal_Int64 n
#define N
unsigned char sal_uInt8
#define SAL_THROW_EXTERN_C()