mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 23:03:27 +08:00
libc: Refine the inline handling
1.Remove CONFIG_HAVE_INLINE macro 2.Change the ANSI C function to normal function 3.Other simple non ANSI function to macro Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
committed by
YAMAMOTO Takashi
parent
993591dca1
commit
60fe0a0f96
@@ -47,13 +47,6 @@
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_HAVE_INLINE
|
||||
void bt_atomic_set(FAR bt_atomic_t *ptr, bt_atomic_t value)
|
||||
{
|
||||
*ptr = value;
|
||||
}
|
||||
#endif
|
||||
|
||||
bt_atomic_t bt_atomic_incr(FAR bt_atomic_t *ptr)
|
||||
{
|
||||
irqstate_t flags;
|
||||
@@ -106,20 +99,6 @@ bt_atomic_t bt_atomic_clrbit(FAR bt_atomic_t *ptr, bt_atomic_t bitno)
|
||||
return value;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_HAVE_INLINE
|
||||
bt_atomic_t bt_atomic_get(FAR bt_atomic_t *ptr)
|
||||
{
|
||||
return *ptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_HAVE_INLINE
|
||||
bool bt_atomic_testbit(FAR bt_atomic_t *ptr, bt_atomic_t bitno)
|
||||
{
|
||||
return (*ptr & (1 << bitno)) != 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool bt_atomic_testsetbit(FAR bt_atomic_t *ptr, bt_atomic_t bitno)
|
||||
{
|
||||
irqstate_t flags;
|
||||
|
||||
@@ -47,54 +47,29 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define bt_atomic_set(ptr, value) (*(ptr) = (value))
|
||||
#define bt_atomic_get(ptr) (*(ptr))
|
||||
#define bt_atomic_testbit(ptr, bitno) ((*(ptr) & (1 << (bitno))) != 0)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
typedef uint8_t bt_atomic_t;
|
||||
|
||||
/****************************************************************************
|
||||
* Inline Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_HAVE_INLINE
|
||||
/* These operations are inherently atomic */
|
||||
|
||||
static inline void bt_atomic_set(FAR bt_atomic_t *ptr, bt_atomic_t value)
|
||||
{
|
||||
*ptr = value;
|
||||
}
|
||||
|
||||
static inline bt_atomic_t bt_atomic_get(FAR bt_atomic_t *ptr)
|
||||
{
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
static inline bool bt_atomic_testbit(FAR bt_atomic_t *ptr,
|
||||
bt_atomic_t bitno)
|
||||
{
|
||||
return (*ptr & (1 << bitno)) != 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_HAVE_INLINE
|
||||
void bt_atomic_set(FAR bt_atomic_t *ptr, bt_atomic_t value);
|
||||
bt_atomic_t bt_atomic_get(FAR bt_atomic_t *ptr);
|
||||
#endif
|
||||
|
||||
bt_atomic_t bt_atomic_incr(FAR bt_atomic_t *ptr);
|
||||
bt_atomic_t bt_atomic_decr(FAR bt_atomic_t *ptr);
|
||||
bt_atomic_t bt_atomic_setbit(FAR bt_atomic_t *ptr, bt_atomic_t bitno);
|
||||
bt_atomic_t bt_atomic_clrbit(FAR bt_atomic_t *ptr, bt_atomic_t bitno);
|
||||
|
||||
#ifndef CONFIG_HAVE_INLINE
|
||||
bool bt_atomic_testbit(FAR bt_atomic_t *ptr, bt_atomic_t bitno);
|
||||
#endif
|
||||
|
||||
bool bt_atomic_testsetbit(FAR bt_atomic_t *ptr, bt_atomic_t bitno);
|
||||
bool bt_atomic_testclrbit(FAR bt_atomic_t *ptr, bt_atomic_t bitno);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user