* Load an array of short values from file to memory. * * Convert to the correct processor architecture, if necessary. * @param buf Buffer to put the loaded short values in. * @param len Number of short values to load. * @param f File handle of the file to load from. * @return Load was succesfull. */
| 159 | * @return Load was succesfull. |
| 160 | */ |
| 161 | static bool load_short(short *buf, int len, FILE *f) |
| 162 | { |
| 163 | size_t result = fread(buf, sizeof(short), len, f); |
| 164 | |
| 165 | if ((int)result != len) { |
| 166 | return false; |
| 167 | } |
| 168 | |
| 169 | SWAP_SHORTS(buf, len); /* to intel */ |
| 170 | |
| 171 | return true; |
| 172 | } |
| 173 | |
| 174 | |
| 175 | /** |