Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2018, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #ifndef __MATH_UTILS_H__ |
| 8 | #define __MATH_UTILS_H__ |
| 9 | |
| 10 | #include <stdint.h> |
| 11 | |
| 12 | /* Simple utility to calculate `power` of a `base` number. */ |
| 13 | static inline unsigned int pow(unsigned int base, unsigned int power) |
| 14 | { |
| 15 | unsigned int result = 1; |
| 16 | while (power) { |
| 17 | result *= base; |
| 18 | power--; |
| 19 | } |
| 20 | return result; |
| 21 | } |
| 22 | |
| 23 | #endif /* __MATH_UTILS_H__ */ |