Initial Release
This commit is contained in:
5
src/common/pico_bit_ops/CMakeLists.txt
Normal file
5
src/common/pico_bit_ops/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
if (NOT TARGET pico_bit_ops_headers)
|
||||
add_library(pico_bit_ops_headers INTERFACE)
|
||||
target_include_directories(pico_bit_ops_headers INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
|
||||
target_link_libraries(pico_bit_ops_headers INTERFACE pico_base_headers)
|
||||
endif()
|
44
src/common/pico_bit_ops/include/pico/bit_ops.h
Normal file
44
src/common/pico_bit_ops/include/pico/bit_ops.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _PICO_BIT_OPS_H
|
||||
#define _PICO_BIT_OPS_H
|
||||
|
||||
#include "pico.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** \file bit_ops.h
|
||||
* \defgroup pico_bit_ops pico_bit_ops
|
||||
*
|
||||
* Optimized bit manipulation functions.
|
||||
* Additionally provides replacement implementations of the compiler built-ins __builtin_popcount, __builtin_clz
|
||||
* and __bulitin_ctz
|
||||
*/
|
||||
|
||||
/*! \brief Reverse the bits in a 32 bit word
|
||||
* \ingroup pico_bit_ops
|
||||
*
|
||||
* \param bits 32 bit input
|
||||
* \return the 32 input bits reversed
|
||||
*/
|
||||
uint32_t __rev(uint32_t bits);
|
||||
|
||||
/*! \brief Reverse the bits in a 64 bit double word
|
||||
* \ingroup pico_bit_ops
|
||||
*
|
||||
* \param bits 64 bit input
|
||||
* \return the 64 input bits reversed
|
||||
*/
|
||||
uint64_t __revll(uint64_t bits);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user