1. A method comprising: in a data storage device including a memory including a plurality of resistance-based storage elements, performing: receiving data represented as a first set of bits, each bit in the first set of bits corresponding to a logical value, wherein a first write current to write a first logical value to a storage element in the memory is less than a second write current to write a second logical value to the storage element; applying a shaping operation to generate a second set of bits, wherein a number of bits having the second logical value is smaller for the second set of bits than for the first set of bits; and writing the second set of bits to the memory.