1.  /* bfs bfr in C
  2.   *
  3.   * header file
  4.   *
  5.   * Michal 'GiM' Spadlinski http://gim.org.pl/ gim@@at@@skrzynka@@dot@@pl
  6.   */
  7.  #ifndef __BSFR_H
  8.  #define __BSFR_H
  9.  
  10.  #ifdef __cplusplus
  11.  extern "C" {
  12.  #endif
  13.  
  14.  /* returns first set bit of input using BSF
  15.   * instruction from 386 assembler instruction set
  16.   * or -1 of input equals 0
  17.   */
  18.  int bsf (unsigned long int input);
  19.  
  20.  /* returns last set bit of input using BSR
  21.   * instruction from 386 assembler instruction set
  22.   * or -1 if input equals 0
  23.   */
  24.  int bsr (unsigned long int input);
  25.  
  26.  #ifdef __cplusplus
  27.  }
  28.  #endif
  29.  
  30.  #endif

This document should validate, please check by clicking: Valid XHTML 1.1