Changeset 187 for trunk


Ignore:
Timestamp:
Jul 24, 2008, 4:22:53 AM (11 years ago)
Author:
cameron
Message:

likely/unlikely - inline vs. macro; add bitstream_segment_from

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/lib_simd.h

    r183 r187  
    3030/* Useful definitions from Linux kernel*/
    3131#ifdef __GNUC__
     32/*
    3233#define likely(x) __builtin_expect((x),1)
    3334#define unlikely(x) __builtin_expect((x),0)
     35*/
     36static inline long likely(long x) {
     37        return __builtin_expect(x, 1);
     38}
     39static inline long unlikely(long x) {
     40        return __builtin_expect(x, 0);
     41}
     42
    3443#endif
    3544#ifdef _MSC_VER
     
    106115}
    107116
     117static inline unsigned long bitstream_segment_from(SIMD_type * stream, int bit_posn) {
     118  unsigned long * bitstream_ptr = (unsigned long *) (((intptr_t) stream) + bit_posn/8);
     119  return sb_op(*bitstream_ptr, bit_posn % 8);
     120}
    108121
    109122/* Scans for a 1 as long as it takes.  Use a sentinel to fence.
Note: See TracChangeset for help on using the changeset viewer.