1
0
Fork 0
mirror of https://github.com/codedread/bitjs synced 2025-10-03 17:49:16 +02:00

Merge pull request #34 from andrebrait/patch-2

Add more details on how to parse the remainders
This commit is contained in:
Jeff Schiller 2022-03-05 09:29:57 -08:00 committed by GitHub
commit abfce6866f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -190,6 +190,10 @@ Packed Data (Total Packed Size) bytes
<ul> <ul>
<li>4 bytes containing an MS-DOS date/time (except for mtime, which is part of FILE_HEAD)</li> <li>4 bytes containing an MS-DOS date/time (except for mtime, which is part of FILE_HEAD)</li>
<li>0 to 3 bytes containing fractions of seconds in 100ns increments</li> <li>0 to 3 bytes containing fractions of seconds in 100ns increments</li>
<ul>
<li>They form a 24-bit integer, sorted from least significant to most significant bits</li>
<li>If fewer than 3 bytes are present, the remaining least significant bits are to be padded with zeroes in order to complete 24-bits</li>
</ul>
</ul> </ul>
<p>Follow the following pseudo-code to read in the ExtTime Structure.</p> <p>Follow the following pseudo-code to read in the ExtTime Structure.</p>
@ -202,31 +206,43 @@ var extTimeFlags = readBits(16)
mtime_rmode = extTimeFlags >> 12 mtime_rmode = extTimeFlags >> 12
if ((mtime_rmode & 8)==0) goto ctime if ((mtime_rmode & 8)==0) goto ctime
mtime_count = mtime_rmode & 0x3 mtime_count = mtime_rmode & 0x3
mtime_remainder = readBits(8*mtime_count); mtime_remainder = 0
for (var i = 0; i < mtime_count; i++) {
mtime_remainder = (readBits(8) << 16) | (mtime_remainder >> 8)
}
if ((mtime_rmode & 4)!=0) mtime_remainder += one_second if ((mtime_rmode & 4)!=0) mtime_remainder += one_second
<b>ctime:</b> <b>ctime:</b>
ctime_rmode = extTimeFlags >> 8 ctime_rmode = extTimeFlags >> 8
if ((ctime_rmode & 8)==0) goto atime if ((ctime_rmode & 8)==0) goto atime
Set ctime to readBits(32) ctime = readBits(32)
ctime_count = ctime_rmode & 0x3 ctime_count = ctime_rmode & 0x3
ctime_remainder = readBits(8*ctime_count) ctime_remainder = 0
for (var i = 0; i < ctime_count; i++) {
ctime_remainder = (readBits(8) << 16) | (ctime_remainder >> 8)
}
if ((ctime_rmode & 4)!=0) ctime_remainder += one_second if ((ctime_rmode & 4)!=0) ctime_remainder += one_second
<b>atime:</b> <b>atime:</b>
atime_rmode = extTimeFlags >> 4 atime_rmode = extTimeFlags >> 4
if ((atime_rmode & 8)==0) goto arctime if ((atime_rmode & 8)==0) goto arctime
Set atime to readBits(32) atime = readBits(32)
atime_count = atime_rmode & 0x3 atime_count = atime_rmode & 0x3
atime_remainder = readBits(8*atime_count) atime_remainder = 0
for (var i = 0; i < atime_count; i++) {
atime_remainder = (readBits(8) << 16) | (atime_remainder >> 8)
}
if ((atime_rmode & 4)!=0) atime_remainder += one_second if ((atime_rmode & 4)!=0) atime_remainder += one_second
<b>arctime:</b> <b>arctime:</b>
arctime_rmode = extTimeFlags arctime_rmode = extTimeFlags
if ((arctime_rmode & 8)==0) goto done_exttime if ((arctime_rmode & 8)==0) goto done_exttime
Set arctime to readBits(32) arctime = readBits(32)
arctime_count = arctime_rmode & 0x3 arctime_count = arctime_rmode & 0x3
arctime_remainder = readBits(8*arctime_count) arctime_remainder = 0
for (var i = 0; i < arctime_count; i++) {
arctime_remainder = (readBits(8) << 16) | (arctime_remainder >> 8)
}
if ((arctime_rmode & 4)!=0) arctime_remainder += one_second if ((arctime_rmode & 4)!=0) arctime_remainder += one_second
<b>done_exttime</b> <b>done_exttime</b>
@ -575,6 +591,7 @@ ZeroCount 4 bits (only present if BitLength is 15)
<ul> <ul>
<li>Eugene Roshal &lt;roshal@rarlab.com&gt; - creator and owner of the RAR format</li> <li>Eugene Roshal &lt;roshal@rarlab.com&gt; - creator and owner of the RAR format</li>
<li>Jeff Schiller &lt;codedread@gmail.com&gt; - creator of this document as part of the <a href="http://github.com/codedread/bitjs/">bitjs</a> project</li> <li>Jeff Schiller &lt;codedread@gmail.com&gt; - creator of this document as part of the <a href="http://github.com/codedread/bitjs/">bitjs</a> project</li>
<li>Andre Brait &lt;andrebrait@gmail.com&gt; - for documenting the ExtTime structure</li>
</ul> </ul>
</section> </section>