#include "ModTypeConversion.h"
#include <SANE.h>


// REQUIRES THE SANE LIBRARY


void MyUnsignedFix2Double(Fixed myFixed, double *myDouble)
{
	*myDouble = (long)((myFixed >> 16L) & 0x0000FFFF) + ((double)(myFixed & 0x0000FFFF) / 65536.0);
}


void MyX2UnsignedFix(extended *myX, Fixed *myFixed)
{
	double	myDouble;
	
	x80tox96(myX, &myDouble);
	MyDouble2UnsignedFix(&myDouble, myFixed);
}


void MyDouble2UnsignedFix(double *myDouble, Fixed *myFixed)
{
	if (*myDouble < 65536.0)
		*myFixed = (((long)*myDouble) << 16L) | ( (long)((*myDouble-((long)*myDouble)) * 65536.0) & 0xFFFF);
	else
		*myFixed = 0xFFFFFFFF;
}