Results 1 to 3 of 3

Thread: guard page

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Administrator Shelwien's Avatar
    Join Date
    May 2008
    Location
    Kharkov, Ukraine
    Posts
    4,138
    Thanks
    320
    Thanked 1,402 Times in 804 Posts

    guard page

    http://rextester.com/GSMTMH44081

    winapi has this feature which allows to mostly remove bound checks from compression algorithms,
    so I made a class which supposedly makes it easier to use.

    guard_buf< (1<<20) > buf;
    buf.init();
    for( j=0; j<3; j++ ) {
    GUARD_BEGIN(buf);
    for( i=0,p=buf;; i++ ) {
    *p++ = byte((i+j)>>0);
    *p++ = byte((i+j)>>8);
    *p++ = byte((i+j)>>16);
    *p++ = byte((i+j)>>24);
    if( buf.flag ) break;
    }
    GUARD_END(buf);
    uint x = (uint&)buf[buf.bufsize];
    printf( "x=%X i=%i/%i\n", x, i,buf.bufsize/4 );
    }

    The idea is that instead of explicit checks in the code, like if( p>=buf+bufsize) on each memory write,
    we can use hardware support (it has almost zero overhead when bound check is never triggered).

    "Guard page" is like normal memory, but triggers the SEH handler on first access, where buf.flag is set.
    Attached Files Attached Files

  2. Thanks (4):

    Bulat Ziganshin (21st September 2018),encode (7th November 2018),Gonzalo (20th September 2018),Mike (20th September 2018)

Similar Threads

  1. any alternative to online page load stopwatch?
    By necros in forum The Off-Topic Lounge
    Replies: 5
    Last Post: 21st March 2016, 14:12
  2. JPEG renovating its web page
    By thorfdbg in forum Data Compression
    Replies: 2
    Last Post: 23rd October 2014, 12:02
  3. memstat: memory status and large page blocks available
    By Bulat Ziganshin in forum Download Area
    Replies: 2
    Last Post: 8th March 2013, 04:41
  4. PAQ8 - Download Page
    By Jan Ondrus in forum Data Compression
    Replies: 7
    Last Post: 7th October 2010, 22:14
  5. Compression Page
    By toffer in forum Data Compression
    Replies: 1
    Last Post: 29th July 2010, 00:13

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •