feat(math/ft_max): adding ft_max
- Using the bitwise for fun 👀
This commit is contained in:
parent
6879b46aee
commit
82c445502b
1 changed files with 18 additions and 0 deletions
18
math/ft_max.c
Normal file
18
math/ft_max.c
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_max.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2025/09/17 16:23:22 by rparodi #+# #+# */
|
||||||
|
/* Updated: 2025/09/17 16:24:17 by rparodi ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
uint32_t ft_max(uint32_t x, uint32_t y)
|
||||||
|
{
|
||||||
|
return (x ^ ((x ^ y) & -(x < y)));
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue