anchor.diff:                              else
                                   PageBlock(firstRegularPageNumber + numRegularPages, firstBlk.lastPage)
   
  -            writeOneBlock 0 startingBlk
  +            let newBlk = writeOneBlock 0 startingBlk
  +            len, newBlk
   
           let pb = PageBuilder(pageSize)
   
  
positive.code:                 // TODO prefixLen is one byte.  should it be two?
                  pb.PutByte(byte st.prefixLen)
                  if st.prefixLen > 0 then
                      let k = (List.head st.keys).pair.Key
                      pb.PutArray(k, 0, st.prefixLen)
                  pb.PutInt16 (st.keys.Length)
                  List.iter (fun lp ->
                      let k = lp.pair.Key
                      let v = lp.pair.Value
                      match lp.keyLoc with
                      | Inline ->
                          pb.PutByte(0uy) // flags
                          pb.PutVarint(int64 k.Length)
                          pb.PutArray(k, st.prefixLen, k.Length - st.prefixLen)
                      | Overflow (klen,kpage) ->
                          pb.PutByte(FLAG_OVERFLOW)
                          pb.PutVarint(int64 klen)
                          pb.PutInt32(kpage)
                      match lp.valueLoc with
                      | Inline ->
                          if null = v then
                              pb.PutByte(FLAG_TOMBSTONE)
                              pb.PutVarint(0L) // TODO remove this
                          else
                              pb.PutByte(0uy)
                              let vlen = v.Length
                              pb.PutVarint(int64 vlen)
                              pb.PutStream(v, int vlen)
                      | Overflow (vlen,vpage) ->
                          pb.PutByte(FLAG_OVERFLOW)
                          pb.PutVarint(int64 vlen)
                          pb.PutInt32(vpage)
  
negative.code:                         st
  
                  let addPairToLeaf (st:LeafState) =
                      // TODO ignore prefixLen for overflowed keys?
                      let newPrefixLen = 
                          if List.isEmpty st.keys then
                              defaultPrefixLen k
                          else
                              bcmp.PrefixMatch ((List.head st.keys).key) k st.prefixLen
                      let sofar = 
                          if newPrefixLen < st.prefixLen then
                              // the prefixLen will change with the addition of this key,
                              // so we need to recalc sofar
                              // TODO is it a problem that we're doing this without List.rev ?
                              List.sumBy (fun lp -> leafPairSize newPrefixLen lp) st.keys
                          else
                              st.sofarLeaf
                      {st with 
                          sofarLeaf=sofar + leafPairSize newPrefixLen lp
                          keys=lp::st.keys
                          prefixLen=newPrefixLen
                          }
                          
                  maybeWriteLeaf {st with blk=blkAfterValue} |> addPairToLeaf
  
              // this is the body of writeLeaves
              //let source = seq { csr.First(); while csr.IsValid() do yield (csr.Key(), csr.Value()); csr.Next(); done }
  