delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/01/05:40:42

Message-ID: <E1FF8239A075D311AF7200A0C9D60AE3048626@probe-2.acclaim-euro.net>
From: Shawn Hargreaves <SHargreaves AT acclaimstudios DOT co DOT uk>
To: djgpp AT delorie DOT com
Subject: Re: What is MID() macro?
Date: Fri, 1 Oct 1999 09:48:53 +0100
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2448.0)
Reply-To: djgpp AT delorie DOT com

Davin McCall writes:
>> #define MID(x,y,z)   MAX((x), MIN((y), (z)))
>
> Surely, if 'x' is the greatest value, this won't work..

It's a clamping function, used to restrict a variable to a legal
range. So x and z should be the constant limits, with x < z,
and y the variable being clamped.


	Shawn Hargreaves.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019