/*
* template.c
*
* Small template-alike functions that are implemented as functions
*
* (C) Frank Schmidt, Jesus@NorseMUD
*
*/
/* return absolute value */
static mixed abs(mixed num) {
#if 0
switch (typeof(num)) {
case T_INT: return (num < 0 ? -num : num);
case T_FLOAT: return (num < 0.0 ? -num : num);
default:
error("Wrong type of argument 1 to function abs()");
break;
}
#else
return num < 0 ? -num : num;
#endif
}
static mixed min(mixed a, mixed b) {
if (a <= b) return a;
else return b;
}
static mixed max(mixed a, mixed b) {
if (a >= b) return a;
else return b;
}