Browse Source

cleancode

pull/636/head
songmingyang 3 years ago
parent
commit
578802f7eb
2 changed files with 3 additions and 7 deletions
  1. +1
    -1
      parser/common/parser_fp16_t.cc
  2. +2
    -6
      parser/common/parser_fp16_t.h

+ 1
- 1
parser/common/parser_fp16_t.cc View File

@@ -1,5 +1,5 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
* Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.


+ 2
- 6
parser/common/parser_fp16_t.h View File

@@ -131,10 +131,6 @@ constexpr uint16_t kFp16MaxValidExp = 0x001E;
/// @ingroup fp16 basic parameter
/// @brief maximum mantissa value of fp16(11111 11111)
constexpr uint16_t kFp16MaxMan = 0x03FF;
/// @ingroup fp16 basic parameter
/// @brief absolute minimum normal value of fp16
/// (E=1,M=0 D=2^(-14)=0.00006103515625)
constexpr uint16_t kFp16MinNormal = 1.0f / (2 << 14);
/// @ingroup fp16 basic operator
/// @brief get sign of fp16
#define FP16_EXTRAC_SIGN(x) (((x) >> 15) & 1)
@@ -605,14 +601,14 @@ T GetManSum(int16_t e_a, const T &m_a, int16_t e_b, const T &m_b) {
T sum = 0;
if (e_a != e_b) {
T m_tmp = 0;
int16_t e_tmp = std::abs(e_a - e_b);
int16_t e_tmp = staic_cast<int16_t>(std::abs(e_a - e_b));
if (e_a > e_b) {
m_tmp = m_b;
m_tmp = RightShift(m_tmp, e_tmp);
sum = m_a + m_tmp;
} else {
m_tmp = m_a;
m_tmp = RightShift(m_tmp, e_tmp);
m_tm= RightShift(m_tmp, e_tmp);
sum = m_tmp + m_b;
}
} else {


Loading…
Cancel
Save