Multi-ApplicationOnlineProfiling  2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
CRC64.h
Go to the documentation of this file.
1 /* ############################ MALP License ############################## */
2 /* # Fri Jan 18 14:00:00 CET 2013 # */
3 /* # Copyright or (C) or Copr. Commissariat a l'Energie Atomique # */
4 /* # # */
5 /* # This software is governed by the CeCILL-C license under French law # */
6 /* # and abiding by the rules of distribution of free software. You can # */
7 /* # use, modify and/ or redistribute the software under the terms of # */
8 /* # the CeCILL-C license as circulated by CEA, CNRS and INRIA at the # */
9 /* # following URL http://www.cecill.info. # */
10 /* # # */
11 /* # The fact that you are presently reading this means that you have # */
12 /* # had knowledge of the CeCILL-C license and that you accept its # */
13 /* # terms. # */
14 /* # # */
15 /* # Authors: # */
16 /* # - BESNARD Jean-Baptiste jean-baptiste.besnard@cea.fr # */
17 /* # # */
18 /* ######################################################################## */
19 
25 #ifndef MALP_CRC64_H
26 #define MALP_CRC64_H
27 
28 #ifdef __cplusplus
29 extern "C"
30 {
31 #endif
32 
33 #include <stdio.h>
34 #include <stdint.h>
35 
42 
46 extern uint64_t crc_table[256];
47 
54 static inline uint64_t MALP_Trace_crc64(char *source, uint64_t size)
55 {
56  uint64_t crc = 0xFFFFFFFFFFFFFFFFULL;
57 
58  uint64_t i = 0;
59 
60  for( i = 0 ; i < size ; i++ )
61  crc = crc_table[(crc ^ source[i]) & 0xff] ^ (crc >> 8);
62 
63  //printf ("%16lX\n", crc);
64 
65  return crc;
66 }
67 
68 #ifdef __cplusplus
69 }
70 #endif
71 
72 #endif
73 
static uint64_t MALP_Trace_crc64(char *source, uint64_t size)
Computes the hash of a given data.
Definition: CRC64.h:54
uint64_t crc_table[256]
crc_table
Definition: CRC64.c:24
void MALP_Trace_crc64_init()
This initializes the CRC64 internals.
Definition: CRC64.c:26