ffs.c
来自「T-kernel 的extension源代码」· C语言 代码 · 共 43 行
C
43 行
/* *---------------------------------------------------------------------- * 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. * *---------------------------------------------------------------------- *//* * ffs.c (common) * */#include <basic.h>/* * Return the position of set bit (bit 1). * Search upward with the position of the least significant bit defined as 1, * and return the position of the first found set bit. * If there is no set bit, return 0. */int ffs( int i ){ W n; if ( i == 0 ) { return 0; } for ( n = 1; (i & 1) == 0; ++n ) { i = (int)((UW)i >> 1); } return n;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?