Posted to tcl by GPS at Sun Sep 16 09:34:18 GMT 2007view pretty

#define ANIMNG_VERSION 1

/* This comes before every frame */
struct animng_frame {
 uint32_t delay; /* 1000 for a second */
 int32_t x, y; /* offset for this frame */
 uint64_t length; /* length after this struct */
};

/* This comes at the start of every file. */
struct animng_header {
 uint8_t id[6]; /* ANIMNG */
 uint8_t version; /* version of animng */
 uint8_t continuous; /* boolean */
 uint64_t frames; /* the total number of frames */
 uint64_t length; /* the length (not including this header struct) */
};

Comments

Posted by GPS at Sun Sep 16 10:11:43 GMT 2007 [text] [code]

#include <stdio.h> #include <stdlib.h> #include <inttypes.h> int main () { uint64_t targetvalue = 0x00adbeeffeedfaceULL; uint8_t parts[7] = {0xad, 0xbe, 0xef, 0xfe, 0xed, 0xfa, 0xce}; uint8_t outparts[7]; uint64_t acc = 0; int i; acc += parts[6]; acc += 0x100 * parts[5]; acc += 0x10000 * parts[4]; acc += 0x1000000ULL * parts[3]; acc += 0x100000000ULL * parts[2]; acc += 0x10000000000ULL * parts[1]; acc += 0x1000000000000ULL * parts[0]; printf ("%llx\n", acc); outparts[0] = acc / 0x1000000000000ULL; outparts[1] = acc / 0x10000000000ULL; outparts[2] = acc / 0x100000000ULL; outparts[3] = acc / 0x1000000ULL; outparts[4] = acc / 0x10000ULL; outparts[5] = acc / 0x100ULL; outparts[6] = acc & 0xff; for (i = 0; i < 7; ++i) { printf ("outparts[%d] = %x\n", i, outparts[i]); } return EXIT_SUCCESS; }