24 lines
1.1 KiB
C
24 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_bit_finder.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2022/11/23 17:31:10 by cchauvet #+# #+# */
|
|
/* Updated: 2022/11/23 18:35:41 by cchauvet ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "pushswap.h"
|
|
|
|
int ft_bit_finder(int big, int tofind)
|
|
{
|
|
int i;
|
|
|
|
i = (int) sizeof(int) * 8 - 1;
|
|
while (i > 0 && ((big >> i) & 1) != tofind)
|
|
i--;
|
|
return (sizeof(int) * 8 - i - 1);
|
|
}
|