Skip to content

Commit

Permalink
[Wasm] Refactor to use std::nullopt.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucagretscher committed Apr 30, 2024
1 parent 36b9603 commit 181b7a4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/backend/WasmAlgo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1269,8 +1269,8 @@ void ChainedHashTable<IsGlobal>::rehash()
if constexpr (IsGlobal) {
if (not rehash_) {
/*----- Backup former local variables to be able to use new ones for rehashing function. -----*/
auto old_address = std::exchange(address_, std::optional<Var<Ptr<void>>>());
auto old_mask = std::exchange(mask_, std::optional<Var<U32x1>>());
auto old_address = std::exchange(address_, std::nullopt);
auto old_mask = std::exchange(mask_, std::nullopt);
/* omit `num_entries_` and `high_watermark_absolute_` as they are never accessed during rehashing */

/*----- Create function for rehashing. -----*/
Expand Down Expand Up @@ -2313,10 +2313,10 @@ void OpenAddressingHashTable<IsGlobal, ValueInPlace>::rehash()
if constexpr (IsGlobal) {
if (not rehash_) {
/*----- Backup former local variables to be able to use new ones for rehashing function. -----*/
auto old_address = std::exchange(address_, std::optional<Var<Ptr<void>>>());
auto old_mask = std::exchange(mask_, std::optional<Var<U32x1>>());
auto old_num_entries = std::exchange(num_entries_, std::optional<Var<U32x1>>());
auto old_high_watermark_absolute = std::exchange(high_watermark_absolute_, std::optional<Var<U32x1>>());
auto old_address = std::exchange(address_, std::nullopt);
auto old_mask = std::exchange(mask_, std::nullopt);
auto old_num_entries = std::exchange(num_entries_, std::nullopt);
auto old_high_watermark_absolute = std::exchange(high_watermark_absolute_, std::nullopt);

/*----- Create function for rehashing. -----*/
FUNCTION(rehash, void(void))
Expand Down

0 comments on commit 181b7a4

Please sign in to comment.