Beispiel #1
0
        public override long Get6ByteLong(long index, int offset)
        {
            long pageId = pageId(index);

            offset += offset(index);
            try
            {
                using (PageCursor cursor = PagedFile.io(pageId, PF_SHARED_READ_LOCK))
                {
                    cursor.Next();
                    long result;
                    do
                    {
                        long low4b  = cursor.GetInt(offset) & 0xFFFFFFFFL;
                        long high2b = cursor.GetShort(offset + Integer.BYTES) & 0xFFFF;
                        result = low4b | (high2b << (sizeof(int) * 8));
                    } while (cursor.ShouldRetry());
                    CheckBounds(cursor);
                    return(result == 0xFFFFFFFFFFFFL ? -1 : result);
                }
            }
            catch (IOException e)
            {
                throw new UncheckedIOException(e);
            }
        }
Beispiel #2
0
        public override int GetInt(long index, int offset)
        {
            long pageId = pageId(index);

            offset += offset(index);
            try
            {
                using (PageCursor cursor = PagedFile.io(pageId, PF_SHARED_READ_LOCK))
                {
                    cursor.Next();
                    int result;
                    do
                    {
                        result = cursor.GetInt(offset);
                    } while (cursor.ShouldRetry());
                    CheckBounds(cursor);
                    return(result);
                }
            }
            catch (IOException e)
            {
                throw new UncheckedIOException(e);
            }
        }
Beispiel #3
0
 internal static int KeyCount(PageCursor cursor)
 {
     return(cursor.GetInt(BytePosKeycount));
 }
Beispiel #4
0
 internal static long Generation(PageCursor cursor)
 {
     return(cursor.GetInt(BytePosGeneration) & GenerationSafePointer.GENERATION_MASK);
 }