summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/eyetil.cc18
-rw-r--r--src/eyetil.h11
2 files changed, 16 insertions, 13 deletions
diff --git a/src/eyetil.cc b/src/eyetil.cc
index 11e2fb7..cd22eea 100644
--- a/src/eyetil.cc
+++ b/src/eyetil.cc
@@ -85,2 +85,7 @@ binary_t md5_digester::final() {
+uint16_t block512_t::tcpcksum(block512_t& data) {
+ uint32_t sum = std::accumulate(data.data,data.data+words,0);
+ while(uint32_t hw = sum>>16) sum = (sum&0xffff)+hw;
+ return 0xffff&~sum;
+}
@@ -152,15 +157,2 @@ bool tarchive_t::read_data_into_fd(int fd) {
-#pragma pack(1)
-struct block512_t {
- enum { words = 512 / sizeof(uint16_t) };
- uint16_t data[words];
-
- static uint16_t tcpcksum(block512_t& data) {
- uint32_t sum = std::accumulate(data.data,data.data+words,0);
- while(uint32_t hw = sum>>16) sum = (sum&0xffff)+hw;
- return 0xffff&~sum;
- }
-
-};
-#pragma pack()
diff --git a/src/eyetil.h b/src/eyetil.h
index 03b9ba8..7517ba6 100644
--- a/src/eyetil.h
+++ b/src/eyetil.h
@@ -65,2 +65,13 @@ template<> inline void md5_digester::update<binary_t>(const binary_t& x) {
+#pragma pack(1)
+struct block512_t {
+ enum { words = 512 / sizeof(uint16_t) };
+ uint16_t data[words];
+
+ inline uint8_t *dptr(size_t o) { return ((uint8_t*)this)+o; }
+
+ static uint16_t tcpcksum(block512_t& data);
+};
+#pragma pack()
+
class tmpdir_t {