Conversions between numeric keys/values and the types expected by Cache.
| 47 | |
| 48 | // Conversions between numeric keys/values and the types expected by Cache. |
| 49 | static std::string EncodeInt(int k) { |
| 50 | faststring result; |
| 51 | PutFixed32(&result, k); |
| 52 | return result.ToString(); |
| 53 | } |
| 54 | static int DecodeInt(const Slice& k) { |
| 55 | CHECK_EQ(4, k.size()); |
| 56 | return DecodeFixed32(k.data()); |