Back to index

lightning-sunbird  0.9+nobinonly
Defines | Typedefs | Functions | Variables
jsbit.h File Reference
#include "jstypes.h"
#include "jsutil.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define JS_TEST_BIT(_map, _bit)   ((_map)[(_bit)>>JS_BITS_PER_WORD_LOG2] & (1L << ((_bit) & (JS_BITS_PER_WORD-1))))
#define JS_SET_BIT(_map, _bit)   ((_map)[(_bit)>>JS_BITS_PER_WORD_LOG2] |= (1L << ((_bit) & (JS_BITS_PER_WORD-1))))
#define JS_CLEAR_BIT(_map, _bit)   ((_map)[(_bit)>>JS_BITS_PER_WORD_LOG2] &= ~(1L << ((_bit) & (JS_BITS_PER_WORD-1))))
#define JS_CEILING_LOG2(_log2, _n)
#define JS_FLOOR_LOG2(_log2, _n)
#define JS_CEILING_LOG2W(n)   ((n) <= 1 ? 0 : 1 + JS_FLOOR_LOG2W((n) - 1))
#define JS_FLOOR_LOG2W(n)   (JS_ASSERT((n) != 0), js_FloorLog2wImpl(n))

Typedefs

typedef jsbitmap_t jsbitmap

Functions

 JS_PUBLIC_API (JSIntn) JS_CeilingLog2(JSUint32 i)

Variables

JS_BEGIN_EXTERN_C typedef JSUword jsbitmap_t

Define Documentation

#define JS_CEILING_LOG2 (   _log2,
  _n 
)
Value:
JS_BEGIN_MACRO                                                            \
        JSUint32 j_ = (JSUint32)(_n);                                         \
        (_log2) = 0;                                                          \
        if ((j_) & ((j_)-1))                                                  \
            (_log2) += 1;                                                     \
        if ((j_) >> 16)                                                       \
            (_log2) += 16, (j_) >>= 16;                                       \
        if ((j_) >> 8)                                                        \
            (_log2) += 8, (j_) >>= 8;                                         \
        if ((j_) >> 4)                                                        \
            (_log2) += 4, (j_) >>= 4;                                         \
        if ((j_) >> 2)                                                        \
            (_log2) += 2, (j_) >>= 2;                                         \
        if ((j_) >> 1)                                                        \
            (_log2) += 1;                                                     \
    JS_END_MACRO

Definition at line 96 of file jsbit.h.

#define JS_CEILING_LOG2W (   n)    ((n) <= 1 ? 0 : 1 + JS_FLOOR_LOG2W((n) - 1))

Definition at line 156 of file jsbit.h.

#define JS_CLEAR_BIT (   _map,
  _bit 
)    ((_map)[(_bit)>>JS_BITS_PER_WORD_LOG2] &= ~(1L << ((_bit) & (JS_BITS_PER_WORD-1))))

Definition at line 57 of file jsbit.h.

#define JS_FLOOR_LOG2 (   _log2,
  _n 
)
Value:
JS_BEGIN_MACRO                                                            \
        JSUint32 j_ = (JSUint32)(_n);                                         \
        (_log2) = 0;                                                          \
        if ((j_) >> 16)                                                       \
            (_log2) += 16, (j_) >>= 16;                                       \
        if ((j_) >> 8)                                                        \
            (_log2) += 8, (j_) >>= 8;                                         \
        if ((j_) >> 4)                                                        \
            (_log2) += 4, (j_) >>= 4;                                         \
        if ((j_) >> 2)                                                        \
            (_log2) += 2, (j_) >>= 2;                                         \
        if ((j_) >> 1)                                                        \
            (_log2) += 1;                                                     \
    JS_END_MACRO

Definition at line 133 of file jsbit.h.

#define JS_FLOOR_LOG2W (   n)    (JS_ASSERT((n) != 0), js_FloorLog2wImpl(n))

Definition at line 164 of file jsbit.h.

#define JS_SET_BIT (   _map,
  _bit 
)    ((_map)[(_bit)>>JS_BITS_PER_WORD_LOG2] |= (1L << ((_bit) & (JS_BITS_PER_WORD-1))))

Definition at line 55 of file jsbit.h.

#define JS_TEST_BIT (   _map,
  _bit 
)    ((_map)[(_bit)>>JS_BITS_PER_WORD_LOG2] & (1L << ((_bit) & (JS_BITS_PER_WORD-1))))

Definition at line 53 of file jsbit.h.


Typedef Documentation

Definition at line 51 of file jsbit.h.


Function Documentation

JS_PUBLIC_API ( JSIntn  )

Definition at line 58 of file jslog2.c.

{
    JSIntn log2;

    JS_FLOOR_LOG2(log2, n);
    return log2;
}

Variable Documentation

Definition at line 50 of file jsbit.h.