16 lines
296 B
C
16 lines
296 B
C
#pragma once
|
|
#include <stdint.h>
|
|
|
|
/* STDLIB DIV FUNCTIONS */
|
|
typedef struct { int32_t quot, rem; } div_t;
|
|
typedef struct { int64_t quot, rem; } ldiv_t;
|
|
div_t div(int num, int den)
|
|
{
|
|
return (div_t){ num/den, num%den };
|
|
}
|
|
ldiv_t ldiv(long num, long den)
|
|
{
|
|
return (ldiv_t){ num/den, num%den };
|
|
}
|
|
|