Path: utzoo!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!mailrus!uunet!samsung!emory!hubcap!grimlok From: grimlok@hubcap.clemson.edu (Mike Percy) Newsgroups: comp.lang.c Subject: Re^2: Using small memory model functions on huge arrays (was See below...) Message-ID: <9150@hubcap.clemson.edu> Date: 29 May 90 17:04:52 GMT Article-I.D.: hubcap.9150 References: <90052709560067@masnet.uucp> <1990May28.000424.20473@druid.uucp> <1990May28.190935.22913@druid.uucp> Organization: Clemson University, Clemson, SC Lines: 22 darcy@druid.uucp (D'Arcy J.M. Cain) writes: [stuff about mixed mode strcpy] >#define mixstrcpy(d, s) { int k = 0; do d[k] = s[k]; while (s[k++]);} >At that point it is probably just as easy to put it inline any way. I >tested the above on Unix but it should work on brain dead OS's as well. With one, possibly trivial, problem. As I have pointed out here before, unless d and s are both huge pointers, the [] operators will fail when used to address items whose byte offset from &array[0] is greater than 64K (we are talking about Intel here, after all). This might need to be #define mixstrcpy(d, s) \ { \ while(*(char huge *)d++ = *(char huge *)s++); \ } We have to use huge; far isn't sufficient, as it wraps around in its segment. But again, unles you know you have really mongo large structures, avoid using huge and incurring its overhead.