/* $Id: cursor.hpp,v 1.4 2006-11-05 04:42:43 ganzhorn Exp $ * This file is part of lfhex. * Copyright (C) 2006 Salem Ganzhorn * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _CURSOR_HPP_ #define _CURSOR_HPP_ #include #include #include #ifdef _LARGEFILE_SOURCE #define MAX_OFFSET LONG_LONG_MAX #else #define MAX_OFFSET LONG_MAX #endif class Cursor { public: Cursor( off_t byteOffset = 0, off_t charOffset = 0, off_t low = 0, off_t high = 1, off_t charsPerByte = 2 ); // defaults to hex Cursor( const Cursor& c); off_t incrByChar( off_t n ); off_t incrByByte( off_t n ); off_t decrByChar( off_t n ); off_t decrByByte( off_t n ); off_t byteOffset() const; //returns the current byte offset off_t charOffset() const; //returns the current char offset. (relative) off_t charOffsetAbsolute() const; //returns the current absolute offset. bool setRange( off_t low, off_t high ); // setCharsPerByte: // sideEffect: sets charOffset to min(_charsPerByte-1,_charOffset) off_t setCharsPerByte( off_t charsPerByte ); void setOffset( off_t byteOffset, off_t charOffset ); protected: // performs: dst = src; and clamps the value to [low,high) void assignClamped(off_t& dst,off_t src,off_t low,off_t high); enum { OutOfRange = -1, }; protected: off_t _byteOffset; off_t _charOffset; off_t _low; off_t _high; off_t _charsPerByte; }; #endif private-remove&id=1ad9bf9fdc29d36baa2db1d0f09ec684ff915f2b'>commitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-04-23 12:07:29 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2016-04-23 12:07:29 -0700
commit1ad9bf9fdc29d36baa2db1d0f09ec684ff915f2b (patch)
treefd9822439cce9931900b4f98f76e171f3797cbe5 /Documentation
parent82b23cb94b8cee25781c209d9b1df3b144c8bb5f (diff)
parentea5dfb5fae81939f777ca569d8cfb599252da2e8 (diff)
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Ingo Molnar: "Misc fixes: two EDAC driver fixes, a Xen crash fix, a HyperV log spam fix and a documentation fix" * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86 EDAC, sb_edac.c: Take account of channel hashing when needed x86 EDAC, sb_edac.c: Repair damage introduced when "fixing" channel address x86/mm/xen: Suppress hugetlbfs in PV guests x86/doc: Correct limits in Documentation/x86/x86_64/mm.txt x86/hyperv: Avoid reporting bogus NMI status for Gen2 instances
Diffstat (limited to 'Documentation')