Jelajahi Sumber

Merge branch 'master' of https://github.com/odin-lang/Odin

gingerBill 5 tahun lalu
induk
melakukan
5d14189a18
3 mengubah file dengan 12 tambahan dan 14 penghapusan
  1. 1 3
      core/mem/mem.odin
  2. 5 5
      core/os/os_darwin.odin
  3. 6 6
      core/os/os_linux.odin

+ 1 - 3
core/mem/mem.odin

@@ -186,9 +186,7 @@ align_backward :: inline proc(ptr: rawptr, align: uintptr) -> rawptr {
 
 align_backward_uintptr :: proc(ptr, align: uintptr) -> uintptr {
 	assert(is_power_of_two(align));
-
-	ptr := rawptr(ptr - align);
-	return uintptr(align_forward(ptr, align));
+	return align_forward_uintptr(ptr - align + 1, align);
 }
 
 align_backward_int :: inline proc(ptr, align: int) -> int {

+ 5 - 5
core/os/os_darwin.odin

@@ -202,10 +202,10 @@ Stat :: struct {
 	gid:           u32, // Group ID of the file's group
 	rdev:          i32, // Device ID, if device
 
-	last_access:   File_Time, // Time of last access
-	modified:      File_Time, // Time of last modification
-	status_change: File_Time, // Time of last status change
-	created:       File_Time, // Time of creation
+	last_access:   _File_Time, // Time of last access
+	modified:      _File_Time, // Time of last modification
+	status_change: _File_Time, // Time of last status change
+	created:       _File_Time, // Time of creation
 
 	size:          i64,  // Size of the file, in bytes
 	blocks:        i64,  // Number of blocks allocated for the file
@@ -273,7 +273,7 @@ foreign libc {
 	@(link_name="lseek")   _unix_lseek   :: proc(fs: Handle, offset: int, whence: int) -> int ---;
 	@(link_name="gettid")  _unix_gettid  :: proc() -> u64 ---;
 	@(link_name="getpagesize") _unix_getpagesize :: proc() -> i32 ---;
-	@(link_name="stat")    _unix_stat    :: proc(path: cstring, stat: ^Stat) -> int ---;
+	@(link_name="stat64")    _unix_stat    :: proc(path: cstring, stat: ^Stat) -> int ---;
 	@(link_name="access")  _unix_access  :: proc(path: cstring, mask: int) -> int ---;
 
 	@(link_name="malloc")  _unix_malloc  :: proc(size: int) -> rawptr ---;

+ 6 - 6
core/os/os_linux.odin

@@ -199,9 +199,9 @@ Stat :: struct {
 	block_size:    i64, // Optimal bllocksize for I/O
 	blocks:        i64, // Number of 512-byte blocks allocated
 
-	last_access:   _File_Time, // Time of last access
-	modified:      _File_Time, // Time of last modification
-	status_change: _File_Time, // Time of last status change
+	last_access:   File_Time, // Time of last access
+	status_change: File_Time, // Time of last status change
+	modified:      File_Time, // Time of last modification
 
 	_reserve1,
 	_reserve2,
@@ -268,7 +268,7 @@ foreign libc {
 	@(link_name="lseek64")          _unix_seek          :: proc(fd: Handle, offset: i64, whence: c.int) -> i64 ---;
 	@(link_name="gettid")           _unix_gettid        :: proc() -> u64 ---;
 	@(link_name="getpagesize")      _unix_getpagesize   :: proc() -> c.int ---;
-	@(link_name="stat")             _unix_stat          :: proc(path: cstring, stat: ^Stat) -> c.int ---;
+	@(link_name="stat64")           _unix_stat          :: proc(path: cstring, stat: ^Stat) -> c.int ---;
 	@(link_name="fstat")            _unix_fstat         :: proc(fd: Handle, stat: ^Stat) -> c.int ---;
 	@(link_name="access")           _unix_access        :: proc(path: cstring, mask: c.int) -> c.int ---;
 
@@ -366,7 +366,7 @@ last_write_time :: proc(fd: Handle) -> (File_Time, Errno) {
 	if err != ERROR_NONE {
 		return 0, err;
 	}
-	return File_Time(s.modified.nanoseconds), ERROR_NONE;
+	return File_Time(s.modified), ERROR_NONE;
 }
 
 last_write_time_by_name :: proc(name: string) -> (File_Time, Errno) {
@@ -374,7 +374,7 @@ last_write_time_by_name :: proc(name: string) -> (File_Time, Errno) {
 	if err != ERROR_NONE {
 		return 0, err;
 	}
-	return File_Time(s.modified.nanoseconds), ERROR_NONE;
+	return File_Time(s.modified), ERROR_NONE;
 }
 
 stat :: inline proc(path: string) -> (Stat, Errno) {