From a11e16e80e4636068f04a5045e0dc759ed57ddb3 Mon Sep 17 00:00:00 2001 From: Dmitry Ilvokhin Date: Mon, 29 Jul 2024 07:01:31 -0700 Subject: [PATCH] Remove implicit integer conversion in `SparseByteSet` Summary: Found when tried to use `SparseByteSet`. Compiler wasn't happy, because `-Wimplicit-int-conversion` flag was set. ``` error: implicit conversion loses integer precision: 'int' to 'uint8_t' (aka 'unsigned char') [-Werror,-Wimplicit-int-conversion] dense_[sparse_[i]] = last_element; ``` Reviewed By: marksantaniello, DenisYaroshevskiy Differential Revision: D60284815 fbshipit-source-id: 5a70acd40f16bb5d31c3f361de1954a55af4d05d --- folly/container/SparseByteSet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/folly/container/SparseByteSet.h b/folly/container/SparseByteSet.h index 4e33f6d3112..6836110901f 100644 --- a/folly/container/SparseByteSet.h +++ b/folly/container/SparseByteSet.h @@ -81,7 +81,7 @@ class SparseByteSet { bool r = contains(i); if (r) { if (dense_[size_ - 1] != i) { - int last_element = dense_[size_ - 1]; + uint8_t last_element = dense_[size_ - 1]; dense_[sparse_[i]] = last_element; sparse_[last_element] = sparse_[i]; }