Commit c1aca3fe by Calvin Buckley

Initial pass at using int64_t instead of long long

Even on systems without C99 where long long and stdint are both
missing, we can shim stdint and point it to any compiler-specific
type (i.e long long, _int64, etc.).

Also next is constant suffixes and determining what needs to
include stdint.
parent 6c78fd06
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include "hash/sha1.h" #include "hash/sha1.h"
struct git_hash_sha1_ctx { struct git_hash_sha1_ctx {
unsigned long long size; uint64_t size;
unsigned int H[5]; unsigned int H[5];
unsigned int W[16]; unsigned int W[16];
}; };
......
...@@ -43,10 +43,10 @@ GIT_INLINE(int) git__is_ulong(int64_t p) ...@@ -43,10 +43,10 @@ GIT_INLINE(int) git__is_ulong(int64_t p)
} }
/** @return true if p fits into the range of an int */ /** @return true if p fits into the range of an int */
GIT_INLINE(int) git__is_int(long long p) GIT_INLINE(int) git__is_int(int64_t p)
{ {
int r = (int)p; int r = (int)p;
return p == (long long)r; return p == (int64_t)r;
} }
/* Use clang/gcc compiler intrinsics whenever possible */ /* Use clang/gcc compiler intrinsics whenever possible */
......
...@@ -137,11 +137,7 @@ typedef unsigned int khint32_t; ...@@ -137,11 +137,7 @@ typedef unsigned int khint32_t;
typedef unsigned long khint32_t; typedef unsigned long khint32_t;
#endif #endif
#if ULONG_MAX == ULLONG_MAX typedef int64_t khint64_t;
typedef unsigned long khint64_t;
#else
typedef unsigned long long khint64_t;
#endif
#ifndef kh_inline #ifndef kh_inline
#ifdef _MSC_VER #ifdef _MSC_VER
......
...@@ -74,7 +74,7 @@ GIT_INLINE(void) git_win32__filetime_to_timespec( ...@@ -74,7 +74,7 @@ GIT_INLINE(void) git_win32__filetime_to_timespec(
const FILETIME *ft, const FILETIME *ft,
struct timespec *ts) struct timespec *ts)
{ {
long long winTime = ((long long)ft->dwHighDateTime << 32) + ft->dwLowDateTime; int64_t winTime = ((int64_t)ft->dwHighDateTime << 32) + ft->dwLowDateTime;
winTime -= 116444736000000000LL; /* Windows to Unix Epoch conversion */ winTime -= 116444736000000000LL; /* Windows to Unix Epoch conversion */
ts->tv_sec = (time_t)(winTime / 10000000); ts->tv_sec = (time_t)(winTime / 10000000);
#ifdef GIT_USE_NSEC #ifdef GIT_USE_NSEC
...@@ -87,7 +87,7 @@ GIT_INLINE(void) git_win32__filetime_to_timespec( ...@@ -87,7 +87,7 @@ GIT_INLINE(void) git_win32__filetime_to_timespec(
GIT_INLINE(void) git_win32__timeval_to_filetime( GIT_INLINE(void) git_win32__timeval_to_filetime(
FILETIME *ft, const struct p_timeval tv) FILETIME *ft, const struct p_timeval tv)
{ {
long long ticks = (tv.tv_sec * 10000000LL) + int64_t ticks = (tv.tv_sec * 10000000LL) +
(tv.tv_usec * 10LL) + 116444736000000000LL; (tv.tv_usec * 10LL) + 116444736000000000LL;
ft->dwHighDateTime = ((ticks >> 32) & 0xffffffffLL); ft->dwHighDateTime = ((ticks >> 32) & 0xffffffffLL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment