Minimize unneeded casts

This commit is contained in:
gingerBill
2021-03-03 14:31:17 +00:00
parent 75f127af7c
commit b727b6438b
24 changed files with 108 additions and 109 deletions
+5 -5
View File
@@ -174,16 +174,16 @@ time_add :: proc(t: Time, d: Duration) -> Time {
ABSOLUTE_ZERO_YEAR :: i64(-292277022399); // Day is chosen so that 2001-01-01 is Monday in the calculations
ABSOLUTE_TO_INTERNAL :: i64(-9223371966579724800); // i64((ABSOLUTE_ZERO_YEAR - 1) * 365.2425 * SECONDS_PER_DAY);
INTERNAL_TO_ABSOLUTE :: i64(-ABSOLUTE_TO_INTERNAL);
INTERNAL_TO_ABSOLUTE :: -ABSOLUTE_TO_INTERNAL;
UNIX_TO_INTERNAL :: i64((1969*365 + 1969/4 - 1969/100 + 1969/400) * SECONDS_PER_DAY);
INTERNAL_TO_UNIX :: i64(-UNIX_TO_INTERNAL);
INTERNAL_TO_UNIX :: -UNIX_TO_INTERNAL;
WALL_TO_INTERNAL :: i64((1884*365 + 1884/4 - 1884/100 + 1884/400) * SECONDS_PER_DAY);
INTERNAL_TO_WALL :: i64(- WALL_TO_INTERNAL);
INTERNAL_TO_WALL :: -WALL_TO_INTERNAL;
UNIX_TO_ABSOLUTE :: i64(UNIX_TO_INTERNAL + INTERNAL_TO_ABSOLUTE);
ABSOLUTE_TO_UNIX :: i64(-UNIX_TO_ABSOLUTE);
UNIX_TO_ABSOLUTE :: UNIX_TO_INTERNAL + INTERNAL_TO_ABSOLUTE;
ABSOLUTE_TO_UNIX :: -UNIX_TO_ABSOLUTE;
_is_leap_year :: proc(year: int) -> bool {
return year%4 == 0 && (year%100 != 0 || year%400 == 0);
+1 -1
View File
@@ -32,6 +32,6 @@ _tick_now :: proc() -> Tick {
now: win32.LARGE_INTEGER;
win32.QueryPerformanceCounter(&now);
_nsec := i64(mul_div_u64(i64(now), 1e9, i64(qpc_frequency)));
_nsec := mul_div_u64(i64(now), 1e9, i64(qpc_frequency));
return Tick{_nsec = _nsec};
}