1 // Copyright 2015 The Gemmlowp Authors. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef GEMMLOWP_META_OPERATIONS_COMMON_H_
16 #define GEMMLOWP_META_OPERATIONS_COMMON_H_
17 
18 class Quantized8BitOperation {
19  public:
Quantized8BitOperation(std::int32_t lhs_offset,std::int32_t rhs_offset,std::int32_t sum_offset,std::int32_t multiplier,std::int32_t shift)20   Quantized8BitOperation(std::int32_t lhs_offset, std::int32_t rhs_offset,
21                          std::int32_t sum_offset, std::int32_t multiplier,
22                          std::int32_t shift)
23       : lhs_offset(lhs_offset),
24         rhs_offset(rhs_offset),
25         sum_offset(sum_offset),
26         multiplier(multiplier),
27         shift(shift) {}
28 
29  protected:
30   std::int32_t lhs_offset;
31   std::int32_t rhs_offset;
32   std::int32_t sum_offset;
33   std::int32_t multiplier;
34   std::int32_t shift;
35 };
36 
37 class FloatOperation {
38  public:
FloatOperation(std::int32_t lhs_offset,std::int32_t rhs_offset,float result_offset)39   FloatOperation(std::int32_t lhs_offset, std::int32_t rhs_offset,
40                  float result_offset)
41       : lhs_offset(lhs_offset),
42         rhs_offset(rhs_offset),
43         result_offset(result_offset) {}
44 
45  protected:
46   std::int32_t lhs_offset;
47   std::int32_t rhs_offset;
48   float result_offset;
49 };
50 
51 class Int32Operation {
52  public:
Int32Operation(std::int32_t lhs_offset,std::int32_t rhs_offset)53   Int32Operation(std::int32_t lhs_offset, std::int32_t rhs_offset)
54       : lhs_offset(lhs_offset), rhs_offset(rhs_offset) {}
55 
56  protected:
57   std::int32_t lhs_offset;
58   std::int32_t rhs_offset;
59 };
60 
61 #endif  // GEMMLOWP_META_OPERATIONS_COMMON_H_
62