var chainit = function(w/*:number*/)/*:void*/ { for(T += w; i<T-1; ++i) o.write_shift(-4, i+1); if(w) { ++i; o.write_shift(-4, ENDOFCHAIN); } }; T = i = 0; for(T+=L[1]; i<T; ++i) o.write_shift(-4, consts.DIFSECT); for(T+=L[2]; i<T; ++i) o.write_shift(-4, consts.FATSECT); chainit(L[3]); chainit(L[4]); var j/*:number*/ = 0, flen/*:number*/ = 0; var file/*:CFBEntry*/ = cfb.FileIndex[0]; for(; j < cfb.FileIndex.length; ++j) { file = cfb.FileIndex[j]; if(!file.content) continue; /*:: if(file.content == null) throw new Error("unreachable"); */ flen = file.content.length; if(flen < 0x1000) continue; file.start = T; chainit((flen + 0x01FF) >> 9); } chainit((L[6] + 7) >> 3); while(o.l & 0x1FF) o.write_shift(-4, consts.ENDOFCHAIN); T = i = 0; for(j = 0; j < cfb.FileIndex.length; ++j) { file = cfb.FileIndex[j]; if(!file.content) continue; /*:: if(file.content == null) throw new Error("unreachable"); */ flen = file.content.length; if(!flen || flen >= 0x1000) continue; file.start = T; chainit((flen + 0x3F) >> 6); } while(o.l & 0x1FF) o.write_shift(-4, consts.ENDOFCHAIN);