Patent ID: 8078793

Claim:
A computer-implemented method for storing data on a non-volatile memory device configured for storing data bits thereon, the data bits being in either an erased state following an erase operation or an updated state following a write operation, which is an inverse of the erased state, the method comprising performing computer-implemented operations for: receiving a request to update a variable stored at a current location in the non-volatile memory device as a plurality of data bits; in response to the request, determining whether the variable is capable of being updated by only inverting a state of one or more data bits used to store the variable at the current location in the non-volatile memory device from the erased state to the updated state; in response to determining that the variable is capable of being updated by only inverting the state of one or more data bits used to store the variable at the current location in the non-volatile memory device from the erased state to the updated state, updating the variable stored in the non-volatile memory device to the updated state by only inverting the state of one or more data bits used to store the variable at the current location in the non-volatile memory device from the erased state to the updated state; and in response to determining that the variable is not capable of being updated by only inverting the state of one or more data bits used to store the variable at the current location in the non-volatile memory device from the erased state to the updated state, then: determining whether the variable is capable of being updated by only inverting a state of an invert flag associated with the variable, the invert flag comprising multiple bits such that when a state of a first bit of the multiple bits of the invert flag is inverted from an erased state to an updated state, then the associated variable is inverted when read from the memory device and when, after the state of the first bit is inverted from the erased state to the updated state, a state of a second bit of the multiple bits of the invert flag is inverted from an erased state to an updated state, then the associated variable is not inverted when read from the memory device, and in response to determining that the variable is capable of being updated by only inverting the state of the invert flag, only inverting the state of the invert flag to update the one or more data bits used to store the variable.