• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 The PDFium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256_H_
8 #define FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256_H_
9 
10 #include <memory>
11 
12 #include "third_party/abseil-cpp/absl/types/optional.h"
13 
14 class CBC_ReedSolomonGF256Poly;
15 
16 class CBC_ReedSolomonGF256 {
17  public:
18   explicit CBC_ReedSolomonGF256(int32_t primitive);
19   ~CBC_ReedSolomonGF256();
20 
GetZero()21   CBC_ReedSolomonGF256Poly* GetZero() const { return m_zero.get(); }
GetOne()22   CBC_ReedSolomonGF256Poly* GetOne() const { return m_one.get(); }
23 
24   std::unique_ptr<CBC_ReedSolomonGF256Poly> BuildMonomial(int32_t degree,
25                                                           int32_t coefficient);
26   static int32_t AddOrSubtract(int32_t a, int32_t b);
27   int32_t Exp(int32_t a);
28   absl::optional<int32_t> Inverse(int32_t a);
29   int32_t Multiply(int32_t a, int32_t b);
30   void Init();
31 
32  private:
33   std::unique_ptr<CBC_ReedSolomonGF256Poly> m_zero;
34   std::unique_ptr<CBC_ReedSolomonGF256Poly> m_one;
35   int32_t m_expTable[256];
36   int32_t m_logTable[256];
37 };
38 
39 #endif  // FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256_H_
40