#include "stdafx.h" #include "asf.h" #include uint64_t get_asf_headsize(void* pbuffer, int ilen) { uint64_t uret = 0; if (ASF_HEADER_SIZE_LEN != ilen || NULL == pbuffer){ return uret; } uint32_t ulowbit = 0; uint32_t uhighbit = 0; memcpy(&ulowbit, pbuffer, sizeof(uint32_t)); memcpy(&uhighbit, (char*)pbuffer + sizeof(uint32_t), sizeof(uint32_t)); return (ulowbit + (uhighbit << 32)); } int construct_asf_headsize(char* pbuffer, int ilen, uint64_t usize) { int iret = -1; if (ASF_HEADER_SIZE_LEN > ilen || NULL == pbuffer){ return iret; } uint32_t uhighbits = (usize >> 32); uint32_t ulowbits = usize; if (uhighbits > 0){ ulowbits = usize - (uhighbits<<32); } memcpy(pbuffer, &ulowbits, sizeof(uint32_t)); memcpy(pbuffer+sizeof(uint32_t), &uhighbits, sizeof(uint32_t)); iret = 0; return iret; }