From 0600734942dad70f1f39bdf03d30d2bfb8823dac Mon Sep 17 00:00:00 2001 From: Antonio SJ Musumeci Date: Fri, 7 Apr 2017 09:47:19 -0400 Subject: [PATCH] handle 32bit and 64bit inode recalculation --- src/fs_inode.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/fs_inode.hpp b/src/fs_inode.hpp index b217305f..37ef18a7 100644 --- a/src/fs_inode.hpp +++ b/src/fs_inode.hpp @@ -19,6 +19,7 @@ #ifndef __FS_INODE_HPP__ #define __FS_INODE_HPP__ +#include #include namespace fs @@ -34,7 +35,11 @@ namespace fs void recompute(struct stat &st) { - st.st_ino |= (st.st_dev << 32); + // not ideal to do this at runtime but usually gets optimized out + if(sizeof(st.st_ino) == 4) + st.st_ino |= ((uint32_t)st.st_dev << 16); + else + st.st_ino |= ((uint64_t)st.st_dev << 32); } } }