score: Delete CPU_USE_GENERIC_BITFIELD_DATA

Rename __log2table into _Bitfield_Leading_zeros since it acually returns
the count of leading zeros of an 8-bit integer.  The value for zero is a
bit odd.  Provide it unconditionally.
This commit is contained in:
Sebastian Huber
2016-06-08 10:10:40 +02:00
parent 987ea1a9d3
commit 18e29faf98
20 changed files with 7 additions and 56 deletions

View File

@@ -200,8 +200,6 @@
#define CPU_USE_GENERIC_BITFIELD_CODE TRUE
#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
#define CPU_PER_CPU_CONTROL_SIZE 0
#define CPU_MAXIMUM_PROCESSORS 32

View File

@@ -851,8 +851,6 @@ void _CPU_Context_Initialize(
#define CPU_USE_GENERIC_BITFIELD_CODE TRUE
#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
/* functions */
/**

View File

@@ -680,8 +680,6 @@ void _CPU_Context_Initialize(
#define CPU_USE_GENERIC_BITFIELD_CODE TRUE
#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
typedef struct {
/* There is no CPU specific per-CPU state */
} CPU_Per_CPU_control;

View File

@@ -549,7 +549,6 @@ extern void _CPU_Fatal_halt(uint32_t source, uint32_t error)
*/
#define CPU_USE_GENERIC_BITFIELD_CODE FALSE
#define CPU_USE_GENERIC_BITFIELD_DATA FALSE
#define _CPU_Bitfield_Find_first_bit( _value, _output ) \
{ \

View File

@@ -883,8 +883,6 @@ extern char _gp[];
#define CPU_USE_GENERIC_BITFIELD_CODE TRUE
#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
/* functions */
/**

View File

@@ -871,8 +871,6 @@ void _CPU_Context_Restart_self(
#define CPU_USE_GENERIC_BITFIELD_CODE TRUE
#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
/* functions */
/**

View File

@@ -491,7 +491,6 @@ void *_CPU_Thread_Idle_body( uintptr_t ignored );
*/
#define CPU_USE_GENERIC_BITFIELD_CODE FALSE
#define CPU_USE_GENERIC_BITFIELD_DATA FALSE
#if ( M68K_HAS_BFFFO != 1 )
/*

View File

@@ -884,8 +884,6 @@ extern void mips_break( int error );
#define CPU_USE_GENERIC_BITFIELD_CODE TRUE
#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
/* functions */
/*

View File

@@ -680,8 +680,6 @@ uint32_t _CPU_ISR_Get_level( void );
#define CPU_USE_GENERIC_BITFIELD_CODE TRUE
#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
/* functions */
/*

View File

@@ -105,8 +105,6 @@ extern "C" {
#define CPU_USE_GENERIC_BITFIELD_CODE TRUE
#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
#define CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK 0
#define CPU_PER_CPU_CONTROL_SIZE 0

View File

@@ -37,17 +37,17 @@ static inline unsigned _Nios2_Count_leading_zeros( uint32_t p )
if ( p <= 0xffffu ) {
if ( p < 0x100u ) {
bitIdx = __log2table[ p ] + 24u;
bitIdx = _Bitfield_Leading_zeros[ p ] + 24u;
} else {
bitIdx = __log2table[ p >> 8u ] + 16u;
bitIdx = _Bitfield_Leading_zeros[ p >> 8u ] + 16u;
}
} else {
p >>= 16u;
if ( p < 0x100u ) {
bitIdx = __log2table[ p ] + 8u;
bitIdx = _Bitfield_Leading_zeros[ p ] + 8u;
} else {
bitIdx = __log2table[ p >> 8u ];
bitIdx = _Bitfield_Leading_zeros[ p >> 8u ];
}
}

View File

@@ -1011,16 +1011,6 @@ uint32_t _CPU_ISR_Get_level( void );
*/
#define CPU_USE_GENERIC_BITFIELD_CODE TRUE
/**
* This definition is set to TRUE if the port uses the data tables provided
* by the generic bitfield manipulation implementation.
* This can occur when actually using the generic bitfield manipulation
* implementation or when implementing the same algorithm in assembly
* language for improved performance. It is unlikely that a port will use
* the data if it has a bitfield scan instruction.
*/
#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
/**
* This routine sets @a _output to the bit number of the first bit
* set in @a _value. @a _value is of CPU dependent type

View File

@@ -675,8 +675,6 @@ void _CPU_Context_Initialize(
#define CPU_USE_GENERIC_BITFIELD_CODE TRUE
#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
typedef struct {
/* There is no CPU specific per-CPU state */
} CPU_Per_CPU_control;

View File

@@ -922,8 +922,6 @@ void _CPU_Context_Initialize(
#define CPU_USE_GENERIC_BITFIELD_CODE FALSE
#define CPU_USE_GENERIC_BITFIELD_DATA FALSE
/*
* This routine sets _output to the bit number of the first bit
* set in _value. _value is of CPU dependent type Priority_bit_map_Word.

View File

@@ -652,8 +652,6 @@ void _CPU_Context_Initialize(
#define CPU_USE_GENERIC_BITFIELD_CODE TRUE
#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
/* functions */
/*

View File

@@ -1113,12 +1113,6 @@ extern void _CPU_Fatal_halt(uint32_t source, uint32_t error)
* CPU model does not have a scan instruction.
*/
#define CPU_USE_GENERIC_BITFIELD_CODE TRUE
/**
* The SPARC port uses the generic C algorithm for bitfield scan if the
* CPU model does not have a scan instruction. Thus is needs the generic
* data table used by that algorithm.
*/
#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
#else
#error "scan instruction not currently supported by RTEMS!!"
#endif

View File

@@ -891,7 +891,6 @@ void _CPU_Context_Initialize(
#if ( SPARC_HAS_BITSCAN == 0 )
#define CPU_USE_GENERIC_BITFIELD_CODE TRUE
#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
#else
#error "scan instruction not currently supported by RTEMS!!"
#endif

View File

@@ -835,8 +835,6 @@ void _CPU_Context_Initialize(
#define CPU_USE_GENERIC_BITFIELD_CODE TRUE
#define CPU_USE_GENERIC_BITFIELD_DATA TRUE
/* functions */
/**

View File

@@ -33,16 +33,12 @@ extern "C" {
*/
/**@{**/
#if ( CPU_USE_GENERIC_BITFIELD_DATA == TRUE )
/**
* This table is used by the generic bitfield routines to perform
* a highly optimized bit scan without the use of special CPU
* instructions.
*/
extern const unsigned char __log2table[256];
#endif
extern const unsigned char _Bitfield_Leading_zeros[256];
/**
* @brief Gets the @a _bit_number of the first bit set in the specified value.
@@ -70,7 +66,7 @@ extern const unsigned char __log2table[256];
#define _Bitfield_Find_first_bit( _value, _bit_number ) \
{ \
register uint32_t __value = (uint32_t) (_value); \
register const unsigned char *__p = __log2table; \
register const unsigned char *__p = _Bitfield_Leading_zeros; \
\
if ( __value < 0x100 ) \
(_bit_number) = (Priority_bit_map_Word)( __p[ __value ] + 8 ); \

View File

@@ -21,8 +21,7 @@
#include <rtems/score/prioritybitmapimpl.h>
#if ( CPU_USE_GENERIC_BITFIELD_DATA == TRUE )
const unsigned char __log2table[256] = {
const unsigned char _Bitfield_Leading_zeros[256] = {
7, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -40,4 +39,3 @@ const unsigned char __log2table[256] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
#endif