亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? bitvect.cxx

?? EFI(Extensible Firmware Interface)是下一代BIOS
?? CXX
字號:
/*++

Copyright (c) 1991-1999 Microsoft Corporation

Module Name:

    bitvect.cxx

Abstract:

    This module contains the definition for thje BITVECTOR class.

Environment:

    ULIB, User Mode

[Notes:]

    optional-notes

--*/

#include <pch.cxx>

#define _ULIB_MEMBER_

#include    "ulib.hxx"
#include    "bitvect.hxx"
#include    <limits.h>

//
// Invalid bit count
//

CONST PT    InvalidBitCount = (PT)(-1);

//
// Static member data.
//

//
// Bits per byte value table e.g. 27->4 bits
//
// Algorithm:
//
//  _BitsSetLookUp[0] = 0;
//
//      For the ranges [1,1],[2,3],[4,7],[8,15],...,[128,255].
//
//      for (n = (( PT ) 1 ); n <= 8; n++) {
//
//
//          Compute range for loop.
//
//          r = (( PT ) 1 ) << (n - (( PT ) 1 ));
//
//
//          [r, 2*r - 1 ] = [0, r - 1] + 1;
//
//          for (i = 0; i < r; i++) {
//              _BitsSetLookUp[i + r] = _BitsSetLookUp[i] + (( PT ) 1 );
//          }
//      }
//    }
//

CONST BYTE  BITVECTOR::_BitsSetLookUp[ 256 ] = {

    0, 1, 1, 2, 1, 2, 2, 3,
    1, 2, 2, 3, 2, 3, 3, 4,
    1, 2, 2, 3, 2, 3, 3, 4,
    2, 3, 3, 4, 3, 4, 4, 5,
    1, 2, 2, 3, 2, 3, 3, 4,
    2, 3, 3, 4, 3, 4, 4, 5,
    2, 3, 3, 4, 3, 4, 4, 5,
    3, 4, 4, 5, 4, 5, 5, 6,
    1, 2, 2, 3, 2, 3, 3, 4,
    2, 3, 3, 4, 3, 4, 4, 5,
    2, 3, 3, 4, 3, 4, 4, 5,
    3, 4, 4, 5, 4, 5, 5, 6,
    2, 3, 3, 4, 3, 4, 4, 5,
    3, 4, 4, 5, 4, 5, 5, 6,
    3, 4, 4, 5, 4, 5, 5, 6,
    4, 5, 5, 6, 5, 6, 6, 7,
    1, 2, 2, 3, 2, 3, 3, 4,
    2, 3, 3, 4, 3, 4, 4, 5,
    2, 3, 3, 4, 3, 4, 4, 5,
    3, 4, 4, 5, 4, 5, 5, 6,
    2, 3, 3, 4, 3, 4, 4, 5,
    3, 4, 4, 5, 4, 5, 5, 6,
    3, 4, 4, 5, 4, 5, 5, 6,
    4, 5, 5, 6, 5, 6, 6, 7,
    2, 3, 3, 4, 3, 4, 4, 5,
    3, 4, 4, 5, 4, 5, 5, 6,
    3, 4, 4, 5, 4, 5, 5, 6,
    4, 5, 5, 6, 5, 6, 6, 7,
    3, 4, 4, 5, 4, 5, 5, 6,
    4, 5, 5, 6, 5, 6, 6, 7,
    4, 5, 5, 6, 5, 6, 6, 7,
    5, 6, 6, 7, 6, 7, 7, 8
};


DEFINE_EXPORTED_CONSTRUCTOR( BITVECTOR, OBJECT, ULIB_EXPORT );

DEFINE_CAST_MEMBER_FUNCTION( BITVECTOR );

VOID
BITVECTOR::Construct (
    )

/*++

Routine Description:

    Construct a BITVECTOR.

Arguments:

    None.

Return Value:

    None.

--*/

{
    REGISTER PT pt;

    //
    //  Find the number of bits per PTs
    //

    _BitsPerPT   = sizeof( PT ) * CHAR_BIT;

    //
    // Set the smallest number of PTs needed
    //

    _PTCount     = (( PT ) 1 );

    //
    //  Create the mask used to separate the array index from the bit index
    //

    _BitPositionMask = _BitsPerPT - (( PT ) 1 );

    //
    //  Count the number of bits required to make the shift count for
    //  accessing the Primitive Type.
    //

    for( _IndexShiftCount = 0, pt = _BitPositionMask; pt;
    pt >>= (( PT ) 1 ), _IndexShiftCount++ );

    //
    // Initialize BITVECTOR state.
    //

    _BitVector      = NULL;
    _PTCount        = 0;
    _FreeBitVector  = FALSE;
}

ULIB_EXPORT
BOOLEAN
BITVECTOR::Initialize (
    IN PT   Size,
    IN BIT  InitialValue,
    IN PPT  Memory
    )

/*++

Routine Description:

    Construct a BITVECTOR with at least the size specified and
    initialize all bits to SET or RESET.

Arguments:

    Size            - Supplies the number of bits in the vector
    InitialValue    - Supplies the initial value for the bits
    Memory          - Supplies a memory buffer to use for the vector

Return Value:

    BOOLEAN - Returns TRUE if the BITVECTOR was succesfully initialized.

Notes:

    Minimum and default BITVECTOR size is the number of bits in
    one PT.  Default initializer is RESET.  The size of a BITVECTOR
    is rounded up to the nearest whole multiple of (_BitsPerPT * CHAR_BIT).

    If the client supplies the buffer it is the client's responsibility
    to ensure that Size and the size of the buffer are in sync.
    Also SetSize will not change the size of a client supplied
    buffer.

--*/

{
    //
    // Destroy the internals of a previous BITVECTOR.
    //

    Destroy( );

    //
    //  Find the number of PTs that will be required for this BITVECTOR
    //  (handles smallest size case (Size = 0) ).
    //

    _PTCount     = Size ? (( Size + _BitsPerPT - (( PT ) 1 )) / _BitsPerPT ) : (( PT ) 1 );

    //
    //  If Memory was supplied use that for the vector else allocate
    // the vector.
    //

    if( Memory ) {

        _BitVector = Memory;

    } else {
        _FreeBitVector = TRUE;
        if( !( _BitVector = ( PT* ) MALLOC(( size_t ) ( _PTCount * sizeof( PT ))))) {

            return FALSE;
        }
    }

    //
    //  Set the bitvector to the supplied value ( SET | RESET )
    //

    ( InitialValue == SET ) ? SetAll( ) : ResetAll( );

    return TRUE;
}

ULIB_EXPORT
BITVECTOR::~BITVECTOR (
    )

/*++

Routine Description:

    Destroy a BITVECTOR by calling it's Destroy function.

Arguments:

    None.

Return Value:

    None.

--*/

{
    Destroy( );
}

VOID
BITVECTOR::Destroy (
    )

/*++

Routine Description:

    Destroy a BITVECTOR by possibly freeing it's internal storage.

Arguments:

    None.

Return Value:

    None.

--*/
{
    if( _FreeBitVector ) {

        DebugAssert( _BitVector != NULL );
        FREE( _BitVector );
    }
}

ULIB_EXPORT
PT
BITVECTOR::SetSize (
    IN PT   Size,
    IN BIT  InitialValue
    )

/*++

Routine Description:

    Set the number of bits in the vector

Arguments:

    Size        - Supplies the number of bits to set the vector size to
    InitialValue- Supplies the initial value for the bits

Return Value:

    PT - Returns the new size of this BITVECTOR in bits.

Notes:

    SetSize will merrily truncate the vector with no warning.

    Minimum and default BITVECTOR size is the number of bits in
    one PT. Default initializer is RESET.  The size of a BITVECTOR
    is rounded up to the nearest whole multiple of (_BitsPerPT * CHAR_BIT).

    If the client supplied the buffer refuse to change it's size

--*/

{
    REGISTER    PT  PTCountNew;
                PT  cbitsNew;
                PT  cbitsOld;

    //
    //  Check that the bitvector was created...
    //

    DebugPtrAssert( _BitVector );
    if( _BitVector == NULL ) {
        return( 0 );
    }

    //
    //  If the client supplied the buffer, refuse to change it's size.
    //

    if( ! _FreeBitVector ) {
        return( _PTCount * _BitsPerPT );
    }


    //
    //  Compute the number of PTs and bits required for the new size
    //

    PTCountNew = Size ? (( Size + _BitsPerPT - (( PT ) 1 ) ) / _BitsPerPT ) : (( PT ) 1 );
    cbitsNew = PTCountNew * _BitsPerPT;

    if( PTCountNew != _PTCount ) {

        //
        //  The new size requires a different number of PTs then the old
        //

#if !defined( _EFICHECK_ )
        
        if( !( _BitVector = ( PT* ) REALLOC(( VOID* ) _BitVector,
        ( size_t ) ( PTCountNew * sizeof( PT ))))) {
            return( 0 );
        }

#else // _EFICHECK_

        // EFI heap manager needs the old size to performa a realloc.
        _BitVector = (PT*)ReallocatePool( _BitVector, _PTCount * sizeof( PT ), PTCountNew * sizeof( PT ) );
        if (_BitVector == 0) {
            return 0;
        }

#endif // _EFICHECK_
    }

    //
    //  If the new size contains more bits, initialize them to the supplied
    //  value
    //

    cbitsOld = _PTCount * _BitsPerPT;
    _PTCount = PTCountNew;

    if( cbitsNew > cbitsOld ) {
        if( InitialValue == SET ) {
            SetBit( cbitsOld, cbitsNew - cbitsOld );
        } else {
            ResetBit( cbitsOld, cbitsNew - cbitsOld );
        }
    }

    return( _PTCount * _BitsPerPT );
}

ULIB_EXPORT
VOID
BITVECTOR::SetBit (
    IN PT   Index,
    IN PT   Count
    )

/*++

Routine Description:

    SET the supplied range of bits

Arguments:

    Index - Supplies the index at which to start setting bits.
    Count - Supplies the number of bits to set.

Return Value:

    None.

Notes:

    It may be faster to compute masks for setting sub-ranges.

--*/

{
    REGISTER    PT  ptCurBit;

    DebugAssert( _BitVector != NULL );
    DebugAssert(( Index + Count ) <= ( _PTCount * _BitsPerPT ));

    // Set count to be the max instead.
    Count += Index;

    for (ptCurBit = Index; (ptCurBit < Count) &&
                           (ptCurBit & _BitPositionMask); ptCurBit++) {
        _BitVector[ptCurBit >> _IndexShiftCount] |=
            (1 << (ptCurBit & _BitPositionMask));
    }

    for (; ptCurBit + 8*sizeof(PT) <= Count; ptCurBit += 8*sizeof(PT)) {
        _BitVector[ptCurBit >> _IndexShiftCount] = 0xffffffff;
    }

    for (; ptCurBit < Count; ptCurBit++) {
        _BitVector[ptCurBit >> _IndexShiftCount] |=
            (1 << (ptCurBit & _BitPositionMask));
    }
}

ULIB_EXPORT
VOID
BITVECTOR::ResetBit (
    IN PT   Index,
    IN PT   Count
    )

/*++

Routine Description:

    RESET the supplied range of bits

Arguments:

    Index - Supplies the index at which to start resetting bits.
    Count - Supplies the number of bits to reset.

Return Value:

    None.

Notes:

    It may be faster to compute masks for resetting sub-ranges.

--*/

{
    REGISTER    PT  ptCurBit;

    DebugAssert( _BitVector != NULL );
    DebugAssert(( Index + Count ) <= ( _PTCount * _BitsPerPT ));

    // Set count to be the max instead.
    Count += Index;

    for (ptCurBit = Index; (ptCurBit < Count) &&
                           (ptCurBit & _BitPositionMask); ptCurBit++) {
        _BitVector[ptCurBit >> _IndexShiftCount] &=
            ~(1 << (ptCurBit & _BitPositionMask));
    }

    for (; ptCurBit + 8*sizeof(PT) <= Count; ptCurBit += 8*sizeof(PT)) {
        _BitVector[ptCurBit >> _IndexShiftCount] = 0;
    }

    for (; ptCurBit < Count; ptCurBit++) {
        _BitVector[ptCurBit >> _IndexShiftCount] &=
            ~(1 << (ptCurBit & _BitPositionMask));
    }
}

VOID
BITVECTOR::ToggleBit (
    IN PT   Index,
    IN PT   Count
    )

/*++

Routine Description:

    Toggle the supplied range of bits.

Arguments:

    Index - Supplies the index at which to start toggling bits.
    Count - Supplies the number of bits to toggle.

Return Value:

    None.

--*/

{
    REGISTER    PT  ptCurBit;

    DebugAssert( _BitVector != NULL );
    DebugAssert( Index + Count <= _PTCount * _BitsPerPT);

    while( Count-- ) {
        ptCurBit = Index + Count;
        if( IsBitSet( ptCurBit )) {
            ResetBit( ptCurBit );
        } else {
            SetBit( ptCurBit );
        }
    }
}

ULIB_EXPORT
PT
BITVECTOR::ComputeCountSet(
    ) CONST

/*++

Routine Description:

    Compute the number of bits that are set in the bitvector using a table
    look up.

Arguments:

    None.

Return Value:

    PT - Returns the number of set bits.

--*/

{
    REGISTER PCBYTE     pbBV;
    REGISTER PT         i;
    REGISTER PT         BitsSet;

    //
    // Cast the bitvector into a string of bytes.
    //

    pbBV = ( PCBYTE ) _BitVector;

    //
    // Initialize the count to zero.
    //

    BitsSet = 0;

    //
    // For all of the bytes in the bitvector.
    //

    for (i = 0; i < _PTCount * sizeof( PT ); i++) {

        //
        // Add the number of bits set in this byte to the total.
        //

        BitsSet += _BitsSetLookUp[pbBV[ i ]];
    }

    return( BitsSet );
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲第一av色| 亚洲欧美另类久久久精品| 99精品视频一区| 午夜av电影一区| 久久先锋影音av| 欧美日韩极品在线观看一区| 精品一区二区三区欧美| 亚洲国产成人在线| 欧美日韩一级黄| 成人一区在线看| 日韩精品欧美成人高清一区二区| 久久久久久影视| 精品视频在线看| 91丨九色丨尤物| 韩国视频一区二区| 国产精品电影一区二区| 久久影音资源网| 欧美日韩视频专区在线播放| 美女视频免费一区| 亚洲综合在线观看视频| 国产欧美一二三区| 欧美亚洲自拍偷拍| 波多野结衣91| 国产在线一区观看| 天堂va蜜桃一区二区三区漫画版| 中文字幕五月欧美| 久久毛片高清国产| 欧美本精品男人aⅴ天堂| 91久久香蕉国产日韩欧美9色| 国产福利91精品一区二区三区| 国产一区日韩二区欧美三区| 丝袜美腿亚洲色图| 国产精品成人免费| 国产精品超碰97尤物18| 国产女人18毛片水真多成人如厕 | 欧美日韩精品久久久| bt欧美亚洲午夜电影天堂| 老司机精品视频导航| 日韩影视精彩在线| 亚洲图片欧美视频| 亚洲电影第三页| 亚洲资源中文字幕| 成人欧美一区二区三区视频网页 | 欧美日韩综合一区| 91久久人澡人人添人人爽欧美| 高清不卡一二三区| 久久爱www久久做| 美女视频黄久久| 亚洲sss视频在线视频| 性欧美大战久久久久久久久| 国产精品网曝门| 亚洲精品高清视频在线观看| 亚洲免费毛片网站| 亚洲成人av一区| 午夜成人免费视频| 日韩电影在线观看网站| 久久99精品国产.久久久久| 免费观看在线色综合| 免费成人你懂的| 国产成人精品免费看| 国产91在线观看| 大尺度一区二区| 一本一道久久a久久精品 | 91免费观看在线| 日本道精品一区二区三区| 在线精品国精品国产尤物884a| 欧美日韩在线播| 7777精品伊人久久久大香线蕉经典版下载| 欧美熟乱第一页| 日韩欧美亚洲国产精品字幕久久久| 欧美一区日本一区韩国一区| 日韩一区二区免费视频| 欧美国产1区2区| 亚洲黄色在线视频| 日日嗨av一区二区三区四区| 国产精品1区2区3区| 99精品偷自拍| 高清国产午夜精品久久久久久| 色婷婷综合在线| 777奇米四色成人影色区| 中文字幕的久久| 亚洲第一电影网| 国产真实精品久久二三区| 色婷婷精品久久二区二区蜜臂av| 欧美优质美女网站| 欧美大胆一级视频| 一区二区三区丝袜| 麻豆精品精品国产自在97香蕉| 国产91高潮流白浆在线麻豆| 欧美三级韩国三级日本一级| 精品不卡在线视频| 国产夜色精品一区二区av| 亚洲成人自拍偷拍| 国产一区二区三区四| 成人av网站在线观看| 日韩三级高清在线| 国产精品午夜久久| 久久99蜜桃精品| 色素色在线综合| 精品少妇一区二区三区| 亚洲图片欧美色图| 成人一级视频在线观看| 在线免费观看一区| 国产亚洲女人久久久久毛片| 亚洲一区二区三区四区不卡| 热久久免费视频| 欧美在线观看视频一区二区三区| 精品日韩一区二区| 2020日本不卡一区二区视频| 奇米色777欧美一区二区| 99热国产精品| 久久伊人中文字幕| 日韩av一区二| 在线免费一区三区| 欧美国产精品专区| 久久国产福利国产秒拍| 色婷婷久久久亚洲一区二区三区 | 国产大陆精品国产| 欧美人与性动xxxx| 亚洲愉拍自拍另类高清精品| 国产91精品一区二区| 欧美色网站导航| 亚洲综合区在线| 成人激情视频网站| 欧美韩日一区二区三区| 久久97超碰国产精品超碰| 欧美三片在线视频观看 | 亚洲国产日产av| 99精品欧美一区二区蜜桃免费| 91精品国产综合久久福利软件| 亚洲国产欧美一区二区三区丁香婷| 成人app在线观看| 欧美一区二区三区公司| 亚洲国产综合人成综合网站| 一本一道综合狠狠老| 亚洲综合免费观看高清完整版| 99r国产精品| 国产日韩欧美一区二区三区乱码| 国产九色精品成人porny| 精品少妇一区二区三区视频免付费 | 色婷婷综合久久| 亚洲精品第一国产综合野| 99视频在线观看一区三区| 欧美精品一区二区三区蜜臀| 蜜桃91丨九色丨蝌蚪91桃色| 在线播放中文字幕一区| 天天色图综合网| 9191国产精品| 舔着乳尖日韩一区| 欧美一级一区二区| 日韩成人免费电影| 欧美一区二区三区啪啪| 男人的j进女人的j一区| 欧美精品乱码久久久久久按摩| 日韩电影免费在线观看网站| 91.com视频| 久久精品国产一区二区三| 国产网站一区二区三区| 丰满亚洲少妇av| 久久综合久久久久88| 成人永久看片免费视频天堂| 亚洲欧洲成人精品av97| 欧美日韩精品专区| 日韩电影网1区2区| 国产午夜亚洲精品不卡 | 天天av天天翘天天综合网| 在线亚洲+欧美+日本专区| 日韩精品高清不卡| 欧美成人精品1314www| 福利一区二区在线| 亚洲日本在线看| 欧美精品123区| 国产超碰在线一区| 亚洲婷婷综合色高清在线| 高清不卡一区二区| 天堂久久久久va久久久久| 精品国产伦一区二区三区观看体验 | 久久久久亚洲综合| 亚洲电影一级黄| 国产亚洲1区2区3区| aaa亚洲精品| 日本不卡123| 国产网站一区二区| 色素色在线综合| 国内精品久久久久影院薰衣草| 欧美激情综合网| 国产999精品久久久久久| 亚洲午夜羞羞片| 久久亚洲精精品中文字幕早川悠里| 在线中文字幕一区| 久久成人免费电影| 亚洲欧美日韩一区二区 | 欧美精品一区二区三区在线 | 日韩一区二区免费电影| 久久国产欧美日韩精品| 综合婷婷亚洲小说| 久久久欧美精品sm网站| 宅男在线国产精品| 91国产免费看| 99久久综合狠狠综合久久|