c166 -div

unsigned short a=10;
unsigned short b;
unsigned short c;
unsigned long d;

b = (unsigned short)(d/2400)/60;   /*ok */ 

==============================================

//sbit p3_0 = P3^0;

unsigned long fun();

unsigned short a=10;
unsigned short b;
unsigned short c;
unsigned long d;
//int a,b;
//long c;

void main()
{
d = (unsigned long)b * a;
// d = (long)b*a;
// b = d / a;
// unsigned long tmp;
// unsigned short tmp1,tmp2;

// #pragma ot(4,size)
// c = ((long)a * b)/10; /* MUL and DIVL */

intrinsic function for 32bit multiplication
hello,
are there intrinsic functions available for the XC164 to use the multiply unit of the ALU?
For example for calculations like:
16bit x 16bit = 32bit (MUL-instruction)or
32bit / 16bit = 16bit (DIVL-instruction)?

regards!
Andreas
 
Read-Only
Author
Mike Kleshov
Posted
5-Jun-2005 12:03 GMT
Toolset
C166
New! RE: intrinsic function for 32bit multiplication
As far as I know, there are no such intrinsic functions. Besides, why would you need them when the compiler emits the appropriae instructions well enough? Just compile the following piece of code and see the compiler output:
int a, b;
long c;

void main(void)
{
	c = a * (long)b;
	b = c / a;
}
Regards,
- mike
 
Read-Only
Author
Andreas Greif
Posted
11-Jun-2005 17:14 GMT
Toolset
C166
New! RE: intrinsic function for 32bit multiplication
Hi Mike,
Thanks for the answer!
With the tasking compiler this was a problem.
With Keil it works well!

regards
Andreas
原文地址:https://www.cnblogs.com/xihong2014/p/10092876.html