mr_notint

mr_notint定义在miracl.h

extern BOOL  mr_notint(flash);

函数功能:判断参数x是否为flash类型数值,返回TRUE或者FALSE

参数xflash类型数值。

1. 源码分析

mr_notint实现在mrcore.c

#define MR_FLASH      52  // 定义在mirdef.h
#define MR_IBITS      32  // 定义在mirdef.h

#ifdef  MR_FLASH
#define MR_EBITS (8*sizeof(double) - MR_FLASH)
                                  /* no of Bits per double exponent */
#define MR_BTS 16
#define MR_MSK 0xFFFF
#endif

#define MR_MSBIT ((mr_lentype)1<<(MR_IBITS-1)) // 将1左移31位

#define MR_OBITS (MR_MSBIT-1)

BOOL mr_notint(flash x)
{ /* returns TRUE if x is Flash */
#ifdef MR_FLASH
    if ((((x->len&(MR_OBITS))>>(MR_BTS))&(MR_MSK))!=0) return TRUE;
#endif
    return FALSE;
}

MR_MSBIT(mr_lentype)1<<(MR_IBITS-1),将1左移31位,得到10000000000000000000000000000000

MR_OBITSMR_MSBIT-1减1,得到01111111111111111111111111111111

x->len&(MR_OBITS)>>(MR_BTS)中,x->len的4字节右移16位,得到高位两字节。如果高位两字节不为0,返回TRUE或者FALSE

© phdlisl all right reserved,powered by GitbookUpdate in 2024-05-19

results matching ""

    No results matching ""