EnglishРусский  

   ..

   HUFFMAN

   LZGE

   gea.c

   gea.def

   gea.h

   memory.c

   memory.h

Реклама

Инсталлятор CreateInstall
Бесплатные и коммерческие инсталляторы

 1 /******************************************************************************
 2 *
 3 * Copyright (C) 2009, The Gentee Group. All rights reserved. 
 4 * This file is part of the Gentee open source project - http://www.gentee.com. 
 5 * 
 6 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE GENTEE LICENSE ("AGREEMENT"). 
 7 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS 
 8 * ACCEPTANCE OF THE AGREEMENT.
 9 *
10 * Author: Alexey Krivonogov ( gentee )
11 *
12 ******************************************************************************/
13 
14 #include "gea.h"
15 
16 //--------------------------------------------------------------------------
17 
18 pvoid STDCALL mem_alloc( dword size )
19 {
20    return VirtualAlloc( NULL, size, 
21                           MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE );
22 }
23 
24 //--------------------------------------------------------------------------
25 
26 void mem_free( pvoid ptr )
27 {
28    VirtualFree( ptr, 0, MEM_RELEASE );
29 }
30 
31 //--------------------------------------------------------------------------
32 
33 pvoid  STDCALL mem_zero( pvoid dest, long len )
34 {
35    pdword  ddest = ( pdword )dest;
36    long    dwlen = len >> 2;
37 
38    while ( dwlen-- ) 
39       *ddest++ = 0;
40    
41    len &= 0x3;
42    while ( len-- )
43       *((pbyte)ddest)++ = 0;
44 
45    return dest;
46 }
47 
48 //--------------------------------------------------------------------------
49 
50 pvoid STDCALL mem_allocz( dword size )
51 {
52    pvoid ptr = mem_alloc( size );
53    return mem_zero( ptr, size );
54 }
55 
56 //--------------------------------------------------------------------------
57 
58 pvoid STDCALL mem_copy( pvoid dest, pvoid src, long len )
59 {
60    pdword dsrc = ( pdword )src;
61    pdword ddest = ( pdword )dest;
62    long   dwlen = len >> 2;
63 
64    while ( dwlen-- ) 
65       *ddest++ = *dsrc++;
66    
67    len &= 0x3;
68    while ( len-- )
69       *((pbyte)ddest)++ = *((pbyte)dsrc)++;
70 
71    return dest;
72 }
73 
74 //--------------------------------------------------------------------------
75 
Редактировать