mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
Add an arch include folder. Implement sqrtf for Cortex-M in math.h. BUG=chrome-os-partner:7920 TEST=none Change-Id: Ib7b480b6a0bf7760f014a1f73df54673a9016cb6 Signed-off-by: Vic Yang <victoryang@chromium.org>
25 lines
459 B
C
25 lines
459 B
C
/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
/* Math utility functions for ARMv7 */
|
|
|
|
#ifndef __EC_MATH_H
|
|
#define __EC_MATH_H
|
|
|
|
#ifdef CONFIG_FPU
|
|
static inline float sqrtf(float v)
|
|
{
|
|
float root;
|
|
asm volatile(
|
|
"fsqrts %0, %1"
|
|
: "=w" (root)
|
|
: "w" (v)
|
|
);
|
|
return root;
|
|
}
|
|
#endif /* CONFIG_FPU */
|
|
|
|
#endif /* __EC_MATH_H */
|