MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / read_data

Function read_data

libCacheSim/traceReader/generalReader/binary.c:180–207  ·  view source on GitHub ↗

* @brief read one piece of data at src according to the format * return the value as int64_t * this limits our format support to int types * * @param src * @param format */

Source from the content-addressed store, hash-verified

178 * @param format
179 */
180static inline int64_t read_data(char *src, char format) {
181 ;
182
183 switch (format) {
184 case 'b':
185 case 'B':
186 case 'c':
187 return (int64_t)(*(int8_t *)src);
188 case 'h':
189 case 'H':
190 return (int64_t)(*(int16_t *)src);
191 case 'i':
192 case 'l':
193 case 'I':
194 case 'L':
195 return (int64_t)(*(int32_t *)src);
196 case 'q':
197 case 'Q':
198 return (int64_t)(*(int64_t *)src);
199 case 'f':
200 return (int64_t)(*(float *)src);
201 case 'd':
202 return (int64_t)(*(double *)src);
203 default:
204 ERROR("DO NOT recognize given format character: %c\n", format);
205 break;
206 }
207}
208
209int binary_read_one_req(reader_t *reader, request_t *req) {
210 binary_params_t *params = (binary_params_t *)reader->reader_params;

Callers 1

binary_read_one_reqFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected