My gc.c file
ANOQ of the Sun
anoq@hardcoreprocessing.com
Mon, 05 Jun 2000 21:10:25 +0200
This is a multi-part message in MIME format.
--------------B09E363249B4ED416AC29157
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hello!
This is my gc.c file - with some debug messages.
It now also has proper functioncalls to get the
system page size and total available memory
on Win32. Except that avaialble memory on
an NT system is always 2GB - I don't know
if this OK...
Cheers
--
http://www.HardcoreProcessing.com
--------------B09E363249B4ED416AC29157
Content-Type: application/x-unknown-content-type-ProjectBuilder.c;
name="gc.c"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="gc.c"
LyogQ29weXJpZ2h0IChDKSAxOTk3LTE5OTkgTkVDIFJlc2VhcmNoIEluc3RpdHV0ZS4KICogUGxl
YXNlIHNlZSB0aGUgZmlsZSBMSUNFTlNFIGZvciBsaWNlbnNlIGluZm9ybWF0aW9uLgogKi8KCiNp
bmNsdWRlICJnYy5oIgoKI2lmIGRlZmluZWQoX1dJTjMyKQojaW5jbHVkZSA8d2luZG93cy5oPgoj
aW5jbHVkZSA8c3lzL3RpbWViLmg+CgovLyBJIF90aGlua18gdGhpcyBpcyBjb3JyZWN0IC0gaXQn
cyBzb21lIGNvbnN0YW50cyBmcm9tIERlbHBoaS4uLgoKI2lmbmRlZiBfU0hfREVOWVJECiNkZWZp
bmUgX09fUkRPTkxZIDAKI2RlZmluZSBfT19XUk9OTFkgMQojZGVmaW5lIF9PX1JEV1IgMgovL09G
X1NIQVJFX0NPTVBBVCAgMAovL09GX1NIQVJFX0VYQ0xVU0lWRSAgMHgxMAojZGVmaW5lIF9TSF9E
RU5ZV1IgIDB4MjAKI2RlZmluZSBfU0hfREVOWVJEICA0OAojZGVmaW5lIF9TSF9ERU5ZTk8gIDB4
NDAKLy9PRl9QQVJTRSAgMHgxMDAKLy9PRl9ERUxFVEUgIDB4MjAwCi8vT0ZfVkVSSUZZICAweDQw
MAovL09GX0NBTkNFTCAgMHg4MDAKLy8jZGVma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