X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Flib.c;h=d0c6de6de0051dcaa9d8c53bbf5bf0527842bbb4;hb=5cab4c07bc13888dc7956194ef9595508072a4eb;hp=36b877c32f37223c9beb87f815adf5493137c364;hpb=e4342ad9de52043cb8f820643794dc44076f9bd9;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/lib.c b/KernelLand/Kernel/lib.c index 36b877c3..d0c6de6d 100644 --- a/KernelLand/Kernel/lib.c +++ b/KernelLand/Kernel/lib.c @@ -180,7 +180,7 @@ int ReadUTF8(const Uint8 *str, Uint32 *Val) } // Four Byte - if( (*str & 0xF1) == 0xF0 ) { + if( (*str & 0xF8) == 0xF0 ) { outval = (*str & 0x07) << 18; // Upper 3 Bits str ++; if( (*str & 0xC0) != 0x80) return 2; // Validity check @@ -287,23 +287,23 @@ Sint64 timestamp(int sec, int min, int hrs, int day, int month, int year) return stamp * 1000; } +static Sint64 DivMod64(Sint64 N, Sint64 D, Sint64 *R); + +static Sint64 DivMod64(Sint64 N, Sint64 D, Sint64 *R) +{ + int sign = (N < 0) != (D < 0); + if(N < 0) N = -N; + if(D < 0) D = -D; + if(sign) + return -DivMod64U(N, D, (Uint64*)R); + else + return DivMod64U(N, D, (Uint64*)R); +} + void format_date(tTime TS, int *year, int *month, int *day, int *hrs, int *mins, int *sec, int *ms) { int is_leap = 0, i; - auto Sint64 DivMod64(Sint64 N, Sint64 D, Sint64 *R); - - Sint64 DivMod64(Sint64 N, Sint64 D, Sint64 *R) - { - int sign = (N < 0) != (D < 0); - if(N < 0) N = -N; - if(D < 0) D = -D; - if(sign) - return -DivMod64U(N, D, (Uint64*)R); - else - return DivMod64U(N, D, (Uint64*)R); - } - // Get time // TODO: Leap-seconds? {