gonzui


Format: Advanced Search

tkernel_2/lib/libsys/src/bittest.cbare sourcepermlink (0.01 seconds)

Search this content:

    1: /*
    2:  *----------------------------------------------------------------------
    3:  *    T-Kernel 2.0 Software Package
    4:  *
    5:  *    Copyright 2011 by Ken Sakamura.
    6:  *    This software is distributed under the latest version of T-License 2.x.
    7:  *----------------------------------------------------------------------
    8:  *
    9:  *    Released by T-Engine Forum(http://www.t-engine.org/) at 2011/05/17.
   10:  *    Modified by T-Engine Forum at 2013/02/12.
   11:  *    Modified by TRON Forum(http://www.tron.org/) at 2015/06/01.
   12:  *
   13:  *----------------------------------------------------------------------
   14:  */
   15: 
   16: /*
   17:  *      bittest.c (libsys)
   18:  */
   19: 
   20: #include <sys/bitop.h>
   21: 
   22: EXPORT BOOL BitTest( const void *base, UW offset )
   23: {
   24: #if BIGENDIAN
   25:         return (BOOL)((((const UB*)base)[offset >> 3] >> (UW)(7U - (offset & 7U))) & 1U);
   26: #else
   27:         return (BOOL)((((const UB*)base)[offset >> 3] >> (UW)(offset & 7U)) & 1U);
   28: #endif
   29: }