| /* |
| * Copyright (C) 2012 The Android Open Source Project |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| #include "rs_types.rsh" |
| |
| extern float __attribute__((overloadable)) dot(float lhs, float rhs) { |
| return lhs * rhs; |
| } |
| extern float __attribute__((overloadable)) dot(float2 lhs, float2 rhs) { |
| return lhs.x*rhs.x + lhs.y*rhs.y; |
| } |
| extern float __attribute__((overloadable)) dot(float3 lhs, float3 rhs) { |
| return lhs.x*rhs.x + lhs.y*rhs.y + lhs.z*rhs.z; |
| } |
| extern float __attribute__((overloadable)) dot(float4 lhs, float4 rhs) { |
| return lhs.x*rhs.x + lhs.y*rhs.y + lhs.z*rhs.z + lhs.w*rhs.w; |
| } |
| |
| extern float __attribute__((overloadable)) fabs(float); |
| extern float __attribute__((overloadable)) sqrt(float); |
| |
| extern float __attribute__((overloadable)) length(float v) { |
| return fabs(v); |
| } |
| extern float __attribute__((overloadable)) length(float2 v) { |
| return sqrt(v.x*v.x + v.y*v.y); |
| } |
| extern float __attribute__((overloadable)) length(float3 v) { |
| return sqrt(v.x*v.x + v.y*v.y + v.z*v.z); |
| } |
| extern float __attribute__((overloadable)) length(float4 v) { |
| return sqrt(v.x*v.x + v.y*v.y + v.z*v.z + v.w*v.w); |
| } |
| |