29 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#include <clc/geometric/clc_dot.h>10#include <clc/internal/clc.h>11#include <clc/math/clc_fabs.h>12#include <clc/math/clc_half_sqrt.h>13 14_CLC_OVERLOAD _CLC_DEF float __clc_fast_length(float p) {15 return __clc_fabs(p);16}17 18_CLC_OVERLOAD _CLC_DEF float __clc_fast_length(float2 p) {19 return __clc_half_sqrt(__clc_dot(p, p));20}21 22_CLC_OVERLOAD _CLC_DEF float __clc_fast_length(float3 p) {23 return __clc_half_sqrt(__clc_dot(p, p));24}25 26_CLC_OVERLOAD _CLC_DEF float __clc_fast_length(float4 p) {27 return __clc_half_sqrt(__clc_dot(p, p));28}29