Skip to content

Commit

Permalink
fix(core): Updated acc to review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
amanCypherock committed Dec 20, 2023
1 parent fd11071 commit ea971c0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
8 changes: 3 additions & 5 deletions common/interfaces/flash_interface/flash_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -642,14 +642,12 @@ bool card_already_deleted_flash(const uint8_t index,

get_flash_ram_instance(); // to load

// If both write state and attempt state for the card number are clear, then
// wallet is already deleted
bool is_already_deleted = IS_Ith_BIT_RESET(
bool wallet_found_on_card = IS_Ith_BIT_SET(
flash_ram_instance.wallets[index].cards_states, card_number - 1);
is_already_deleted &= IS_Ith_BIT_RESET(
bool write_attempted_on_card = IS_Ith_BIT_SET(
flash_ram_instance.wallets[index].cards_states, card_number - 1 + 4);

return is_already_deleted;
return !(wallet_found_on_card | write_attempted_on_card);
}

/**
Expand Down
1 change: 0 additions & 1 deletion common/libraries/util/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
#define UTIL_IN_BOUNDS (0xAA)

#define IS_Ith_BIT_SET(x, i) (((x) & (1 << (i))) != 0)
#define IS_Ith_BIT_RESET(x, i) (((x) & (1 << (i))) == 0)
#define SET_Ith_BIT(x, i) ((x) |= (1 << (i)))
#define RESET_Ith_BIT(x, i) ((x) &= ~(1 << (i)))

Expand Down

0 comments on commit ea971c0

Please sign in to comment.