1 //===-- llvm/Support/JamCRC.h - Cyclic Redundancy Check ---------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file contains an implementation of JamCRC.
11 // We will use the "Rocksoft^tm Model CRC Algorithm" to describe the properties
19 // Check : 340BC6D9 (result of CRC for "123456789")
21 // N.B. We permit flexibility of the "Init" value. Some consumers of this need
24 //===----------------------------------------------------------------------===//
26 #ifndef LLVM_SUPPORT_JAMCRC_H
27 #define LLVM_SUPPORT_JAMCRC_H
29 #include "llvm/Support/DataTypes.h"
32 template <typename T
> class ArrayRef
;
36 JamCRC(uint32_t Init
= 0xFFFFFFFFU
) : CRC(Init
) {}
38 // Update the CRC calculation with Data.
39 void update(ArrayRef
<char> Data
);
41 uint32_t getCRC() const { return CRC
; }
46 } // End of namespace llvm