brintos

brintos / llvm-project-archived public Read only

0
0
Text · 798 B · 8993618 Raw
20 lines · plain
1//===----------------------------------------------------------------------===//2//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-exception6//7//===----------------------------------------------------------------------===//8 9// We need to use shifts here in order to mantain the sign bit for signed10// integers.  The compiler should optimize this to (x & 0x00FFFFFF) for11// unsigned integers.12#define CONVERT_TO_24BIT(x) (((x) << 8) >> 8)13 14_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_mul24(__CLC_GENTYPE x,15                                                 __CLC_GENTYPE y) {16  return CONVERT_TO_24BIT(x) * CONVERT_TO_24BIT(y);17}18 19#undef CONVERT_TO_24BIT20