X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Fld-acess.so_src%2Flib.c;h=150ae77cff61812d0748f77f5d38ae393ac9c308;hb=11686aa86bc0adae2555aa7796fe229770bb02f7;hp=27d6ff29d18261ca943ef3d68c2325f2fcafd553;hpb=193a19846230cd653ca61b65d54538974116c1ea;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/ld-acess.so_src/lib.c b/Usermode/Libraries/ld-acess.so_src/lib.c index 27d6ff29..150ae77c 100644 --- a/Usermode/Libraries/ld-acess.so_src/lib.c +++ b/Usermode/Libraries/ld-acess.so_src/lib.c @@ -4,6 +4,7 @@ By thePowersGang */ #include "common.h" +#include // === CODE === char *strcpy(char *dest, const char *src) @@ -70,3 +71,31 @@ int file_exists(const char *filename) close(fd); return 1; } + +uint64_t __udivdi3(uint64_t Num, uint64_t Den) +{ + uint64_t ret = 0, add = 1; + + // Find what power of two times Den is > Num + while( Num >= Den ) + { + Den <<= 1; + add <<= 1; + } + + // Search backwards + while( add > 1 ) + { + add >>= 1; + Den >>= 1; + // If the numerator is > Den, subtract and add to return value + if( Num > Den ) + { + ret += add; + Num -= Den; + } + } +// if(Rem) *Rem = Num; + return ret; +} +