| 110 | |
| 111 | |
| 112 | HeapValue* HeapValue::createStr(tags valueTag, slice s) { |
| 113 | uint8_t sizeBuf[kMaxVarintLen32]; |
| 114 | size_t sizeByteCount = 0; |
| 115 | int tiny; |
| 116 | if (s.size < 0x0F) { |
| 117 | tiny = (int)s.size; |
| 118 | } else { |
| 119 | tiny = 0x0F; |
| 120 | sizeByteCount = PutUVarInt(&sizeBuf, s.size); |
| 121 | } |
| 122 | auto hv = new (sizeByteCount + s.size) HeapValue(valueTag, tiny); |
| 123 | uint8_t *strData = &hv->_header + 1; |
| 124 | memcpy(strData, sizeBuf, sizeByteCount); |
| 125 | memcpy(strData + sizeByteCount, s.buf, s.size); |
| 126 | return hv; |
| 127 | } |
| 128 | |
| 129 | |
| 130 | HeapValue* HeapValue::create(const Value *v) { |
nothing calls this directly
no test coverage detected