Skip to content

Commit f47f289

Browse files
laurynas-biveinisinikep
authored andcommitted
MyRocks: fix thread_id_indexer_t::get_rnd_index compilation under macOS (facebook#1203)
Summary: On macOS, get_curr_thread_id returns a pointer, which does not implicitly convert to std::size_t. So reinterpret_cast it to std::uintptr_t first, which then implicitly converts to std::size_t. Patch by percona-ysorokin taken from https://github.com/percona/percona-server/pull/4808/files#diff-981be3a881c5028de47081c4e03740624d79a39ae1109a8e09814d135bd152ed Pull Request resolved: facebook#1203 Reviewed By: Pushapgl Differential Revision: D38956490 Pulled By: hermanlee fbshipit-source-id: c7f6968
1 parent 56479ef commit f47f289

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

storage/rocksdb/ut0counter.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ struct thread_id_indexer_t : public generic_indexer_t<Type, N> {
8383
/* @return a random number, currently we use the thread id. Where
8484
thread id is represented as a pointer, it may not work as
8585
effectively. */
86-
size_t get_rnd_index() const { return get_curr_thread_id(); }
86+
size_t get_rnd_index() const {
87+
return reinterpret_cast<std::uintptr_t>(get_curr_thread_id());
88+
}
8789
};
8890

8991
/** For counters wher N=1 */

0 commit comments

Comments
 (0)