Patent ID: 9632708
Date: 2017-04-25
CPC Classifications: G06F,G11C

Claim:
1. A method for reading and writing data, the method comprising: acquiring first data to be written into a storage device and an address for the first data; acquiring, according to the address, second data that has been written into the storage device; acquiring configuration information, wherein the configuration information comprises a data bit width, a bit quantity of a data flag, and a preset stepping algorithm, and the data bit width indicates a bit width of the first data; generating, according to the bit quantity of the data flag and the bit width of the first data and by using the preset stepping algorithm, a candidate data set corresponding to the first data, wherein each piece of data in the candidate data set is uniquely corresponding to a value of one data flag; comparing data in the candidate data set with the second data, so as to acquire third data that is in the candidate data set and meets a preset rule; and writing the third data into the storage device according to the address, so as to calculate and read the first data according to the third data and a value of a data flag corresponding to the third data, when the first data needs to be read from the storage device.