Commit c3d8da5
read-cache: use get_be32 instead of hand-rolled ntoh_l
Commit d60c49c (read-cache.c: allow unaligned mapping of the
index file, 2012-04-03) introduced helpers to access
unaligned data. However, we already have get_be32, which has
a few advantages:
1. It's already written, so we avoid duplication.
2. It's probably faster, since it does the endian
conversion and the alignment fix at the same time.
3. The get_be32 code is well-tested, having been in
block-sha1 for a long time. By contrast, our custom
helpers were probably almost never used, since the user
needed to manually define a macro to enable them.
We have to add a get_be16 implementation to the existing
get_be32, but that is very simple to do.
Signed-off-by: Jeff King <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>1 parent 802b123 commit c3d8da5
2 files changed
+16
-32
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| 139 | + | |
139 | 140 | | |
140 | 141 | | |
141 | 142 | | |
142 | 143 | | |
143 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
144 | 148 | | |
145 | 149 | | |
146 | 150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1313 | 1313 | | |
1314 | 1314 | | |
1315 | 1315 | | |
1316 | | - | |
1317 | | - | |
1318 | | - | |
1319 | | - | |
1320 | | - | |
1321 | | - | |
1322 | | - | |
1323 | | - | |
1324 | | - | |
1325 | | - | |
1326 | | - | |
1327 | | - | |
1328 | | - | |
1329 | | - | |
1330 | | - | |
1331 | | - | |
1332 | | - | |
1333 | | - | |
1334 | | - | |
1335 | | - | |
1336 | 1316 | | |
1337 | 1317 | | |
1338 | 1318 | | |
1339 | 1319 | | |
1340 | 1320 | | |
1341 | 1321 | | |
1342 | 1322 | | |
1343 | | - | |
1344 | | - | |
1345 | | - | |
1346 | | - | |
1347 | | - | |
1348 | | - | |
1349 | | - | |
1350 | | - | |
1351 | | - | |
1352 | | - | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
1353 | 1333 | | |
1354 | 1334 | | |
1355 | 1335 | | |
| |||
1389 | 1369 | | |
1390 | 1370 | | |
1391 | 1371 | | |
1392 | | - | |
| 1372 | + | |
1393 | 1373 | | |
1394 | 1374 | | |
1395 | 1375 | | |
1396 | 1376 | | |
1397 | 1377 | | |
1398 | 1378 | | |
1399 | | - | |
| 1379 | + | |
1400 | 1380 | | |
1401 | 1381 | | |
1402 | 1382 | | |
| |||
0 commit comments