📄 bitsclr.c
字号:
/* *---------------------------------------------------------------------- * T-Kernel / Standard Extension * * Copyright (C) 2006 by Ken Sakamura. All rights reserved. * T-Kernel / Standard Extension is distributed * under the T-License for T-Kernel / Standard Extension. *---------------------------------------------------------------------- * * Version: 1.00.00 * Released by T-Engine Forum(http://www.t-engine.org) at 2006/8/11. * *---------------------------------------------------------------------- *//* * bitsclr.c (common) */#include <bitop.h>#include <libstr.h>#define TSD_BCR_N_8 8#define TSD_BCR_MSK_7 7U/* * Clear the bit string. * Clear the width bits from the position of specified bit. */EXPORT void BitsClr( VP base, W offset, W width ){ UB *bp; INT n; n = offset / TSD_BCR_N_8; bp = (UB*)base + n; n = (W)((UW)offset & TSD_BCR_MSK_7); if ( n > 0 ) { for ( ; n < TSD_BCR_N_8; ++n ) { if ( --width < 0 ) { return; } BitClr(bp, (UW)n); } bp++; } n = width / TSD_BCR_N_8; if ( n > 0 ) { memset(bp, 0U, (size_t)n); } bp += n; width -= n * TSD_BCR_N_8; for ( n = 0; n < width; ++n ) { BitClr(bp, (UW)n); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -