[libc-commits] [libc] [libc][NFC] Adjust use of off_t internally (PR #68269)
Guillaume Chatelet via libc-commits
libc-commits at lists.llvm.org
Thu Oct 5 01:49:41 PDT 2023
================
@@ -19,15 +19,19 @@ namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(ssize_t, pwrite,
(int fd, const void *buf, size_t count, off_t offset)) {
-#ifdef LIBC_TARGET_ARCH_IS_RISCV32
- static_assert(sizeof(off_t) == 8);
- ssize_t ret = LIBC_NAMESPACE::syscall_impl<ssize_t>(
- SYS_pwrite64, fd, buf, count, (long)offset,
- (long)(((uint64_t)(offset)) >> 32));
-#else
- ssize_t ret = LIBC_NAMESPACE::syscall_impl<ssize_t>(SYS_pwrite64, fd, buf,
- count, offset);
-#endif
+
+ ssize_t ret;
+ if constexpr (sizeof(off_t) == 8 && sizeof(size_t) == 4) {
+ // This is a 32-bit system with a 64-bit offset.
+ long offset_low = static_cast<long>(offset);
+ long offset_high = static_cast<long>(offset >> 32);
----------------
gchatelet wrote:
same here
https://github.com/llvm/llvm-project/pull/68269
More information about the libc-commits
mailing list