MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / ReadValue

Function ReadValue

tensorflow/core/lib/wav/wav_io.h:71–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69// stream of data.
70template <class T>
71Status ReadValue(const string& data, T* value, int* offset) {
72 int new_offset;
73 TF_RETURN_IF_ERROR(
74 IncrementOffset(*offset, sizeof(T), data.size(), &new_offset));
75 if (port::kLittleEndian) {
76 memcpy(value, data.data() + *offset, sizeof(T));
77 } else {
78 *value = 0;
79 const uint8* data_buf =
80 reinterpret_cast<const uint8*>(data.data() + *offset);
81 int shift = 0;
82 for (int i = 0; i < sizeof(T); ++i, shift += 8) {
83 *value = *value | (data_buf[i] << shift);
84 }
85 }
86 *offset = new_offset;
87 return Status::OK();
88}
89
90} // namespace wav
91} // namespace tensorflow

Callers 3

TESTFunction · 0.70
AddInputMethod · 0.50
ReadValueMethod · 0.50

Calls 3

IncrementOffsetFunction · 0.85
sizeMethod · 0.45
dataMethod · 0.45

Tested by 1

TESTFunction · 0.56