A poorly written OS for the x86 arch. (WIP)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
eOS/lib/util.c

14 lines
269 B

#include "util.h"
uint ulong_len(ulong n) { // get the digit length of a number
int len = 0;
while (n != 0) {
n = n / 10;
++len;
}
return len;
}
uint ndigit(ulong n, uint i) { // OBS: index order is reversed
return (n/(10**i)) % 10
}