zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    小型的Unix系统字符SHELL
    小型的Unix系统字符SHELL
    string 大小写转换
    string 大小写转换
    string 大小写转换
    ACM 的中取模
    ACM 的中取模
    使用adb命令停止APP后台进程的方法
    how to use adb and gdbserver with VirtualBox
    CentOS的KVM实践(虚拟机创建、网桥配置、Spice)
  • 原文地址:https://www.cnblogs.com/xihong2014/p/10092876.html
Copyright © 2011-2022 走看看