亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? math.c

?? TDK 6521 SOC 芯片 DEMO程序
?? C
?? 第 1 頁 / 共 4 頁
字號:
/***************************************************************************
 * This code and information is provided "as is" without warranty of any   *
 * kind, either expressed or implied, including but not limited to the     *
 * implied warranties of merchantability and/or fitness for a particular   *
 * purpose.                                                                *
 *                                                                         *
 * Copyright (C) 2005 Teridian Semiconductor Corp. All Rights Reserved.    *
 ***************************************************************************/
//**************************************************************************
//  DESCRIPTION: 71M652x Meter MATH library. 
// 
//  AUTHOR:  MTF
//
//  HISTORY: See end of file.
//**************************************************************************
// File:  CLASSICS.C
//
#include "options.h"
#include "library.h"
#include "mmath.h"

//===========================================================================//
// Binary addition of 8n-bit 'x',
//                 to 8n-bit 'y'.
// *x += *y;       returns carry.
int8_t add (uint8x_t *x, uint8p_t *y, uint8_t n) 
{   // *x += y; where 'x' & 'y' are 'n' bytes wide.
    uint8_16_t t;                       // Carry is always 0 or 1.

    x += n - 1;                         // Point to LSB of 'x'.
    y += n - 1;                         // Point to LSB of 'y'.
    t.c[ HI ] = 0;                      // Initial 'carry' is zero (0).

    do
    {                                   // Single precision add plus carry.
       t.i = *x + *y + t.c[ HI ];       // Compute one-byte sum and carry.         
       *x = t.c[ LO ];                  // x[ n - 1].
       x--;  y--;
    } while (--n);

    return ((int8_t) t.c[ HI ]);        // Last 'carry' can be -1.
}

#if EXTRAS || !MATH_FAST || (AUTOCAL && \
    (EQUATION != _1ELEMENT_3WIRE \
     && EQUATION != _2ELEMENT_4WIRE_DELTA \
     && EQUATION != _2ELEMENT_4WIRE_WYE))
// Binary addition of 8-bit 'y',
//                 to 8n-bit 'x'.
// *x += y_;       returns carry.
int8_t add_1 (uint8x_t *x, uint8_t n, int8_t y_)
{   // *x += y; where 'x' is 'n' bytes wide, 'y_' is 8-bit integer.
    int8_16_t t;                        // Carry is 0, 1 or -1.
    
    x += --n;                           
    t.i = *x + y_;                      // (Carry,Sum) = *x + y_.
                                        // Sign extended.
    do
    {
       *x = t.c[ LO ];                  // LSB of sum.
       x--;                             // Next.
        
       t.i = *x + t.c[ HI ];            // Plus carry (sign extended).
    } while (--n);

    *x = t.c[ LO ];                     // LSB of sum.
    return (t.c[ HI ]);                 // Last 'carry'.
}
#endif

#if EXTRAS
#pragma save
#pragma NOAREGS
// Binary addition of 16-bit 'y_',
//                 to 8n-bit 'x'.
// *x += y_;       returns carry.
int8_t add_2 (uint8x_t *x, uint8_t n, int16_t y_) small reentrant
{            // *x += y; where 'x' is 'n' bytes wide, 'y_' is 16-bit int.
    int8_16_t t;                        // Carry is 0, 1 or -1.

    x += --n;
    t.i = *x + (uint8_t) (y_ & 0xFF);   // (Carry,Sum) = *x + y_.
    *x = t.c[ LO ];      x--;           // x[n - 1] of sum.
                                        // x[n - 2] of sum.         
    t.i = *x + (y_ >> 8) + t.c[ HI ];   // Sign extended.
    --n;

    do
    {
       *x = t.c[ LO ];                  // LSB of sum.
       x--;                             // Next.
       t.i = *x + t.c[ HI ];            // Plus carry (sign extended).
    } while (--n);

    *x = t.c[ LO ];                     // LSB of sum.
    return (t.c[ HI ]);                 // Last 'carry'.
}
#pragma restore
#endif

#if (EQUATION != _1ELEMENT_3WIRE) && (WATT_SUMS || VAR_SUMS || VA_SUMS || AUTOCAL)
// Binary addition of 64-bit 'y',
//                 to 64-bit 'x'.
// *x += *y;
#if MATH_FAST
void add8_8 (uint8x_t *x, uint8x_t *yy) 
{                                       // (uint64_t *) *x += (uint64_t *) *y;
    uint8_16_t t;                       // Carry is always 0 or 1.
    uint8_t pdata yi[8];
    uint8_t pdata *y;

    y = yi;
    memcpy_px (y, yy, 8);
    x += 8 - 1;                         // Point to LSB of 'x'.
    y += 8 - 1;                         // Point to LSB of 'y'.

    // Compute one-byte sums and associated carries;
    t.i = *x + *y;                *x = t.c[ LO ];      x--;  y--;  // x[7] of sum.         
    t.i = *x + *y + t.c[ HI ];    *x = t.c[ LO ];      x--;  y--;  // x[6] of sum.         
    t.i = *x + *y + t.c[ HI ];    *x = t.c[ LO ];      x--;  y--;  // x[5] of sum.         
    t.i = *x + *y + t.c[ HI ];    *x = t.c[ LO ];      x--;  y--;  // x[4] of sum.         
    t.i = *x + *y + t.c[ HI ];    *x = t.c[ LO ];      x--;  y--;  // x[3] of sum.         
    t.i = *x + *y + t.c[ HI ];    *x = t.c[ LO ];      x--;  y--;  // x[2] of sum.         
    t.i = *x + *y + t.c[ HI ];    *x = t.c[ LO ];      x--;  y--;  // x[1] of sum.         
    *x +=      *y + t.c[ HI ];    // x[0] of sum (assumes no more carries).
}
#else
void add8_8 (uint8x_t *x, uint8x_t *yy) 
{
    uint8_t pdata y[8];

    memcpy_px (y, yy, 8);
    add (x, y, 8);
}
#endif // MATH_FAST.
#endif // WATT_SUMS/VAR_SUMS/VA_SUMS.

// Binary addition of 32-bit 'y',
//                 to 64-bit 'x'.
// *x += *y;
#if MATH_FAST
void add8_4 (uint8x_t *x, uint8p_t *y) 
{                                       // (uint64_t *) *x += (U32 *) *y;
    int8_16_t t;                        // Carry is always 0, 1 or -1.

    x += 8 - 1;                         // Point to LSB of 'x'.
    y += 4 - 1;

    // Compute one-byte sums and associated carries;
    t.i = *x + *y;                *x = t.c[ LO ];      x--;  y--;  // x[7] of sum.         
    t.i = *x + *y + t.c[ HI ];    *x = t.c[ LO ];      x--;  y--;  // x[6] of sum.         
    t.i = *x + *y + t.c[ HI ];    *x = t.c[ LO ];      x--;  y--;  // x[5] of sum.         
    t.i = *x + (int8_t) *y + t.c[ HI ];                 // Forces sign extension.
                                  *x = t.c[ LO ];      x--;        // x[4] of sum.         
    t.i = *x      + t.c[ HI ];    *x = t.c[ LO ];      x--;        // x[3] of sum.
    t.i = *x      + t.c[ HI ];    *x = t.c[ LO ];      x--;        // x[2] of sum.
    t.i = *x      + t.c[ HI ];    *x = t.c[ LO ];      x--;        // x[1] of sum.
    *x +=           t.c[ HI ];    // x[0] of sum (assumes no more carries).
}
#else
void add8_4 (uint8x_t *x, uint8p_t *y) 
{
    add_1 (x, 4, add (x + 4, y, 4));
}
#endif // MATH_FAST.

//===========================================================================//
// Binary subtraction of 8n-bit 'y'
//                  from 8n-bit 'x'.
// *x -= *y;        returns borrow.
int8_t sub (uint8x_t *x, uint8p_t *y, uint8_t n) 
{                                       // *x -= *y; where 'x' & 'y' are 'n' bytes wide.
    int8_16_t t;                        // Borrow is always 0, 1 or -1.

    x += n - 1;                         // Point to LSB of 'x'.
    y += n - 1;                         // Point to LSB of 'y'.
    t.c[ HI ] = 0;                      // Initial 'borrow' is zero (0).

    do
    {                                   // Single precision subtract plus borrow.
       t.i  = *x - *y + t.c[ HI ];   
       *x = t.c[ LO ];                  // Compute one-byte difference and borrow.
       x--;  y--;                       // x[ n - 1].
    } while (--n);

    return (t.c[ HI ]);                 // Last 'borrow'.
}

#if EXTRAS
// Binary subtraction of 8-bit 'y',
//                 from 8n-bit 'x'.
// x -= y;         returns the borrow.
int8_t sub_1 (uint8x_t *x, uint8_t n, int8_t y_)
{                                       // x -= y; where 'x' is 'n' bytes wide, 'y' is single byte.                        
    int8_16_t t;                        // Borrow is always 0, 1 or -1.

    x += --n;                           // Point to LSB of 'x'.
    t.i = *x - y_;                      // (Borrow,Sum) = *x - y.

    do
    {
       *x = t.c[ LO ];                  // LSB of difference.
       x--;                             // Next.
       t.i = *x + t.c[ HI ];            // Plus borrow (sign extended).
    } while (--n);

    *x = t.c[ LO ];                     // LSB of sum.
    return (t.c[ HI ]);                 // Last 'borrow'.
}

// Binary subtraction of 16-bit 'y_',
//                  from 8n-bit 'x'.
// *x += y_;       returns borrow.
int8_t sub_2 (uint8x_t *x, uint8_t n, int16_t y_)
{   // *x += y; where 'x' is 'n' bytes wide, 'y_' is 16-bit integer.
    int8_16_t t;                        // Forces sign extensions.

    x += --n;
    t.i = *x - (uint8_t) (y_ & 0xFF);   // (Carry,Sum) = *x + y.
    *x = t.c[ LO ];      x--;           // x[n - 1] of sum.
                                        // x[n - 2] of sum.         
    t.i = *x - (y_ >> 8) + t.c[ HI ];   // Sign extended.
    --n;

    do
    {
       *x = t.c[ LO ];                  // LSB of sum.
       x--;                             // Next.
       t.i = *x + t.c[ HI ];            // Plus carry (sign extended).
    } while (--n);

    *x = t.c[ LO ];                     // LSB of sum.
    return (t.c[ HI ]);                 // Last 'carry'.
}

// Binary subtraction 64-bit 'y',
//               from 64-bit 'x'.
// *x -= *y;
void sub8_8 (uint8x_t *x, uint8p_t *y) 
{                                       // Subtract (in-place)  8-byte 'y' from 8-byte 'x'.
    int8_16_t t;                        // Borrow is always 0, 1 or -1.

    x += 8 - 1;                         // Point to LSB of 'x'.
    y += 8 - 1;                         // Point to LSB of 'y'.

    // Compute one-byte differences and borrows.
    t.i = *x - *y;                *x = t.c[ LO ];   x--;  y--; // x[7] of difference.
    t.i = *x - *y + t.c[ HI ];    *x = t.c[ LO ];   x--;  y--; // x[6] of difference.
    t.i = *x - *y + t.c[ HI ];    *x = t.c[ LO ];   x--;  y--; // x[5] of difference.
    t.i = *x - *y + t.c[ HI ];    *x = t.c[ LO ];   x--;  y--; // x[4] of difference.
    t.i = *x - *y + t.c[ HI ];    *x = t.c[ LO ];   x--;  y--; // x[3] of difference.
    t.i = *x - *y + t.c[ HI ];    *x = t.c[ LO ];   x--;  y--; // x[2] of difference.
    t.i = *x - *y + t.c[ HI ];    *x = t.c[ LO ];   x--;  y--; // x[1] of difference.
     *x = *x - *y + t.c[ HI ];    // x[0] of difference (assumes no more borrows).
}
#endif // EXTRAS.

#if ABS_VALUE
// Binary subtraction 32-bit 'y',
//               from 64-bit 'x'.
// x -= y;
void sub8_4 (uint8x_t *x, uint8p_t *y) 
{                                       // Subtract (in-place)  4-byte 'y' from 8-byte 'x'.
    int8_16_t t;                        // Borrow is always 0, 1 or -1.

    x += 8 - 1;                         // Point to LSB of 'x'.
    y += 4 - 1;                         // Point to LSB of 'y'.

    // Compute one-byte differences and borrows.
    t.i = *x - *y;                *x = t.c[ LO ];   x--;  y--; // x[7] of difference.
    t.i = *x - *y + t.c[ HI ];    *x = t.c[ LO ];   x--;  y--; // x[6] of difference.
    t.i = *x - *y + t.c[ HI ];    *x = t.c[ LO ];   x--;  y--; // x[5] of difference.
    t.i = *x - (int8_t) *y + t.c[ HI ];                     // Force sign extension.    
                                  *x = t.c[ LO ];   x--;  y--; // x[4] of difference.
    t.i = *x      + t.c[ HI ];    *x = t.c[ LO ];   x--;  y--; // x[3] of difference.
    t.i = *x      + t.c[ HI ];    *x = t.c[ LO ];   x--;  y--; // x[2] of difference.
    t.i = *x      + t.c[ HI ];    *x = t.c[ LO ];   x--;  y--; // x[1] of difference.
    *x +=           t.c[ HI ];    // x[0] of difference (assumes no more borrows).
}
#endif // EXTRAS.

#if !MATH_FAST
//===========================================================================//
// Binary multiplication of 8m-bit 'y',
//                      and 8n-bit 'x',
//    leaving result in 8(n+m)-bit 'w'; 't' is a scratchpad for partial products.
// *w = *x * *y; 
void multiply (uint8x_t *w, uint8x_t *x, uint8_t m, uint8p_t *y, uint8_t n, uint8p_t *t) 
{                                       // ((m+n)-byte) w = (m-byte) x * (n-byte) y;
    n--;
    w += n;                             // Point to low-order 'm+1' bytes of product 'w'.
    y += n;                             // Point to LSB of 'y'.
    memset_x (w, 0, m + 1);             // Initially (m+1)-byte partial product is zero (0).
                                  
    do                                  // Accumulate partial products.
    {                                   // ((m+1)-byte) w += (m-byte) x * y.
        *(w - 1) = macp (w, x, m, *y, t);  w--;  y--;  // Point to w[n] & y[n].      
    } while (--n);
                                        
    macp (w, x, m, *y, t);              // ((m-byte) w += (m-byte) x * y; No carry possible.
}

// Multiply and accumulate positive 8n-bit partial product into 'w'.
// Multiplication of 8n-bit 'x',
//               and  8-bit 'y_', accumulated positive into 'w'.
// *w += *x * y_;       't' is a scratchpad for partial products.
uint8_t macp (uint8x_t *w, uint8x_t *x, uint8_t n, uint8_t y_, uint8p_t *t) 
{                                       // ((n+1)-byte) w += (n-byte) x * (uint8_t) y;
    *t = multiply_1 (t + 1, x, n, y_);  // ((n+1)-byte) t  = (n-byte) x * (uint8_t) y;
    return ((uint8_t) add (w, t, n + 1));   // Return carry; ((n+1)-byte) w += ((n+1)-byte) t;
}
#endif

// w = x * y; n is the length

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品伦理在线| 在线国产电影不卡| 精品夜夜嗨av一区二区三区| 亚洲狠狠爱一区二区三区| 亚洲精品欧美激情| 一区二区三区四区乱视频| 亚洲婷婷国产精品电影人久久| 日本一区免费视频| 国产精品蜜臀av| 亚洲欧美日韩国产另类专区| 亚洲欧美综合另类在线卡通| 中文在线资源观看网站视频免费不卡| 日本一区二区免费在线观看视频 | 看国产成人h片视频| 秋霞影院一区二区| 精品中文字幕一区二区| 国产美女一区二区三区| 国产激情视频一区二区在线观看| 国产成a人无v码亚洲福利| 成人高清伦理免费影院在线观看| 97久久超碰国产精品| 色激情天天射综合网| 欧美日韩在线播放一区| 欧美成人r级一区二区三区| 久久夜色精品国产欧美乱极品| 无码av免费一区二区三区试看| 丝瓜av网站精品一区二区| 久久电影网站中文字幕| 成人免费av在线| 在线观看网站黄不卡| 日韩欧美一级二级三级久久久| 久久久高清一区二区三区| 日韩一区中文字幕| 日韩av一级片| 国产精品69久久久久水密桃| 色综合色综合色综合| 欧美一级精品大片| 国产精品美女久久久久久久久久久| 一区二区三区视频在线观看| 麻豆精品新av中文字幕| 成人福利视频在线看| 91精品国产色综合久久| 欧美国产禁国产网站cc| 午夜欧美视频在线观看| 国产成人免费视频精品含羞草妖精 | 亚洲三级电影网站| 日韩中文字幕91| 粉嫩aⅴ一区二区三区四区五区| 欧美在线免费视屏| 国产午夜亚洲精品羞羞网站| 亚洲一线二线三线视频| 国产一区91精品张津瑜| 欧美性做爰猛烈叫床潮| 日本一区二区成人| 天堂久久久久va久久久久| 国产成a人亚洲精品| 91.成人天堂一区| 日韩码欧中文字| 经典三级一区二区| 欧美性大战xxxxx久久久| 久久九九全国免费| 爽好久久久欧美精品| 91天堂素人约啪| 欧美精品一区二区三区蜜桃| 一区二区三区av电影| 懂色av一区二区三区免费看| 日韩一区二区三区av| 亚洲一区在线观看视频| 成人国产免费视频| 久久九九久久九九| 美国十次综合导航| 欧美日韩精品一区二区三区四区| 中文字幕不卡在线播放| 精品中文av资源站在线观看| 欧美日韩卡一卡二| 亚洲欧美日韩一区| 成人激情综合网站| 久久视频一区二区| 久久精品久久久精品美女| 欧美日韩一区二区不卡| 亚洲人成精品久久久久久| 丁香五精品蜜臀久久久久99网站| 精品国产污污免费网站入口 | 日韩不卡免费视频| 欧美伊人久久久久久久久影院 | 亚洲欧洲另类国产综合| 国产一区91精品张津瑜| 精品久久一区二区| 免费久久99精品国产| 欧美日韩激情一区| 亚洲国产视频一区二区| 91久久奴性调教| 综合久久久久久| 91网站在线观看视频| 国产精品久久久久久久午夜片| 国产九色sp调教91| 久久精品一区四区| 高清不卡一区二区在线| 亚洲国产精华液网站w| 国v精品久久久网| 国产欧美日韩在线观看| 国产精品一二三在| 国产日韩欧美麻豆| 成人高清视频免费观看| 中文字幕巨乱亚洲| 成人免费va视频| 综合激情成人伊人| 一本大道av伊人久久综合| 亚洲欧美aⅴ...| 欧美性感一区二区三区| 亚洲大型综合色站| 日韩欧美电影一区| 韩国精品在线观看| 国产午夜精品久久久久久久| 国产成人一区在线| 亚洲欧洲日韩综合一区二区| 色综合久久久久综合体桃花网| 一区二区三区精品久久久| 欧美四级电影在线观看| 日韩影视精彩在线| 精品免费日韩av| 成人精品电影在线观看| 亚洲日本乱码在线观看| 欧美精品日韩一本| 精品在线你懂的| 亚洲国产精华液网站w| 色综合久久综合| 日本在线播放一区二区三区| 精品免费一区二区三区| av高清久久久| 亚洲成人免费在线| 久久久99精品免费观看不卡| 91色在线porny| 午夜精品久久久久久久99水蜜桃 | 欧美一区二区黄| 国产91丝袜在线观看| 亚洲欧美成aⅴ人在线观看| 欧美二区在线观看| 懂色av噜噜一区二区三区av| 一卡二卡欧美日韩| 亚洲精品在线网站| 99久久精品费精品国产一区二区| 亚洲电影在线播放| 久久久久一区二区三区四区| 91丨porny丨国产入口| 日本一道高清亚洲日美韩| 国产日韩欧美激情| 91精品在线观看入口| 粉嫩蜜臀av国产精品网站| 亚洲福利电影网| 国产精品久久久久影院| 欧美精品123区| 豆国产96在线|亚洲| 日本最新不卡在线| 中文字幕一区av| 欧美一级欧美三级在线观看| 成人动漫av在线| 久久精品av麻豆的观看方式| 亚洲视频中文字幕| 久久这里只有精品6| 色综合久久中文字幕综合网| 久久精品国产免费| 一区二区高清免费观看影视大全 | 夜夜亚洲天天久久| 国产午夜一区二区三区| 正在播放一区二区| 色综合久久综合中文综合网| 国产精品77777| 麻豆精品视频在线观看视频| 一区二区三区日韩欧美| 国产日韩欧美激情| 精品久久久久久久久久久院品网| 欧洲亚洲精品在线| 99精品视频一区二区| 国产一区二区三区四区五区美女| 天天射综合影视| 亚洲精品国产视频| 欧美国产禁国产网站cc| 26uuu亚洲婷婷狠狠天堂| 欧美麻豆精品久久久久久| 91国在线观看| av在线这里只有精品| 国产成人精品影视| 精品一区二区三区久久久| 亚洲aⅴ怡春院| 亚洲一区二区综合| 1区2区3区欧美| 欧美国产日韩亚洲一区| 久久综合狠狠综合久久激情| 日韩女优av电影在线观看| 91精品视频网| 欧美日韩国产色站一区二区三区| 91极品视觉盛宴| 99精品视频中文字幕| 成人黄色软件下载| 成人午夜免费视频| 国产91精品一区二区麻豆网站| 国产精品456| 国产成人av福利| 丰满亚洲少妇av|