TT Zephyr Platforms 18.11.99
Tenstorrent Firmware
Loading...
Searching...
No Matches
util.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Tenstorrent AI ULC
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef TENSTORRENT_BH_ARC_UTIL_H_
8#define TENSTORRENT_BH_ARC_UTIL_H_
9
10#include <stdint.h>
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16static inline uint32_t low32(uint64_t val)
17{
18 return val & 0xFFFFFFFF;
19}
20
21static inline uint32_t high32(uint64_t val)
22{
23 return val >> 32;
24}
25
26static inline void FlipBytes(uint8_t *buf, uint32_t byte_size)
27{
28 uint32_t temp = 0;
29
30 for (uint32_t i = 0; i < byte_size / 2; i++) {
31 temp = buf[i];
32 buf[i] = buf[byte_size - 1 - i];
33 buf[byte_size - 1 - i] = temp;
34 }
35}
36
37#ifdef __cplusplus
38}
39#endif
40
41#endif
static uint8_t buf[1]
Definition log_backend_ringbuf.c:24
__UINT32_TYPE__ uint32_t
__UINT64_TYPE__ uint64_t
__UINT8_TYPE__ uint8_t
static uint32_t low32(uint64_t val)
Definition util.h:16
static uint32_t high32(uint64_t val)
Definition util.h:21
static void FlipBytes(uint8_t *buf, uint32_t byte_size)
Definition util.h:26