/* $Id: Rescale.c,v 1.1 1997/04/17 13:20:41 archer Exp $
 *	RESCALE.C - Use by various scales
 *
 * Prototypes are in miscP.h
 */
/* Needed by GCC prototypes */
#define __USE_FIXED_PROTOTYPES__
#include "config.h"
#include <Widget/miscP.h>


/**
 ** X11_RESCALE_LONG
 **	Adjust a value to a given scale
 **/
long x11__rescale_long(long value, long start, long end)
{
/*
 * Special cases
 */
	if (start == 0)
		return end;
	if (value == 0)
		return 0;
/*** HACK ***/ /* fails when > 65536! */
	value *= end;
	value += start/2;
	return value / start;
}
