예제 #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);
            }
        }
예제 #2
0
        public override int Get3ByteInt(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
                    {
                        int lowWord  = cursor.GetShort(offset) & 0xFFFF;
                        int highByte = cursor.GetByte(offset + Short.BYTES) & 0xFF;
                        result = lowWord | (highByte << (sizeof(short) * 8));
                    } while (cursor.ShouldRetry());
                    CheckBounds(cursor);
                    return(result == 0xFFFFFF ? -1 : result);
                }
            }
            catch (IOException e)
            {
                throw new UncheckedIOException(e);
            }
        }
예제 #3
0
        public override short GetShort(long index, int offset)
        {
            long pageId = pageId(index);

            offset += offset(index);
            try
            {
                using (PageCursor cursor = PagedFile.io(pageId, PF_SHARED_READ_LOCK))
                {
                    cursor.Next();
                    short result;
                    do
                    {
                        result = cursor.GetShort(offset);
                    } while (cursor.ShouldRetry());
                    CheckBounds(cursor);
                    return(result);
                }
            }
            catch (IOException e)
            {
                throw new UncheckedIOException(e);
            }
        }