<div dir="ltr">On Mon, Aug 29, 2011 at 03:40, Andrew Coppin <span dir="ltr">&lt;<a href="mailto:andrewcoppin@btinternet.com">andrewcoppin@btinternet.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
    I meant if you&#39;re trying to *implement* serialisation. The Bits<br>
    class allows you to access bits one by one, but surely you&#39;d want<br>
    some way to know how many bits you need to keep?<br>

<br>
I think that falls into the realm of protocol design; if you&#39;re doing it<br>
in your program at runtime, you&#39;re probably doing it wrong.  (The fixed<br>
size version makes sense for marshaling; it&#39;s *dynamic* sizes that need<br>
to be thought out beforehand.)<br>
</blockquote>
<br></div>
If you&#39;re doing, say, cryptography, then thousand-bit random integers that need to be serialised are fairly common...</blockquote><div><br></div><div>Sure, and there are encodings that let you do this without needing bitSize (BER).  You need a word count, but that&#39;s usually part of the structure holding the integer.</div>
</div><div><br></div>-- <br>brandon s allbery                                      <a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a><br>wandering unix systems administrator (available)     (412) 475-9364 vm/sms<br>
<br>
</div>