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

  1. #define ANIMNG_VERSION 1
  2.  
  3. /* This comes before every frame */
  4. struct animng_frame {
  5. uint32_t delay; /* 1000 for a second */
  6. int32_t x, y; /* offset for this frame */
  7. uint64_t length; /* length after this struct */
  8. };
  9.  
  10. /* This comes at the start of every file. */
  11. struct animng_header {
  12. uint8_t id[6]; /* ANIMNG */
  13. uint8_t version; /* version of animng */
  14. uint8_t continuous; /* boolean */
  15. uint64_t frames; /* the total number of frames */
  16. uint64_t length; /* the length (not including this header struct) */
  17. };
  18.  

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; }