您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DIGIT函数代码示例

51自学网 2021-06-01 20:21:55
  C++
这篇教程C++ DIGIT函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中DIGIT函数的典型用法代码示例。如果您正苦于以下问题:C++ DIGIT函数的具体用法?C++ DIGIT怎么用?C++ DIGIT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了DIGIT函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: mp_get_double

static MVMnum64 mp_get_double(mp_int *a) {    MVMnum64 d    = 0.0;    MVMnum64 sign = SIGN(a) == MP_NEG ? -1.0 : 1.0;    int i;    if (USED(a) == 0)        return d;    if (USED(a) == 1)        return sign * (MVMnum64) DIGIT(a, 0);    mp_clamp(a);    i = USED(a) - 1;    d = (MVMnum64) DIGIT(a, i);    i--;    if (i == -1) {        return sign * d;    }    d *= pow(2.0, DIGIT_BIT);    d += (MVMnum64) DIGIT(a, i);    if (USED(a) > 2) {        i--;        d *= pow(2.0, DIGIT_BIT);        d += (MVMnum64) DIGIT(a, i);    }    d *= pow(2.0, DIGIT_BIT * i);    return sign * d;}
开发者ID:baby-gnu,项目名称:MoarVM,代码行数:28,


示例2: GREADR

void GREADR(Word *a_, Word *t_){       Word C,S,a,t;       /* hide algorithm */Step1: /* Skip blanks and read sign, if any. */       t = 1; S = 1;       C = CREADB();       if (C == '+')         C = CREADB();       else if (C == '-')         { C = CREADB(); S = -1; }       if (DIGIT(C) == 0)         { SWRITE("Error GREADR: A digit was expected./n"); goto Step3; }Step2: /* Read digits and convert. */       a = 0;       do         { a = 10 * a + C - '0'; C = CREAD(); }       while (!(DIGIT(C) == 0));       BKSP(); a = S * a; goto Return;Step3: /* Error. */       DIELOC(); t = 0; goto Return;Return: /* Prepare for return. */       *a_ = a;       *t_ = t;       return;}
开发者ID:fchapoton,项目名称:qepcad-1,代码行数:30,


示例3: speaknum

void speaknum(int n){	int buf[20], len = 0;		if (n % 10) buf[len++] = DIGIT(n % 10);	n /= 10;	if (n > 0) {		buf[len++] = TEN;		if (n % 10 > 1) buf[len++] = DIGIT(n % 10);		n /= 10;		if (n > 0) {			buf[len++] = HUNDRED;			if (n % 10 > 1) buf[len++] = DIGIT(n % 10);			n /= 10;			if (n > 0) {				buf[len++] = THOUSAND;				if (n % 10 > 1) buf[len++] = DIGIT(n % 10);				n /= 10;				if (n > 0) {					buf[len++] = TENTHOUSAND;					if (n % 10 > 1) buf[len++] = DIGIT(n % 10);				}			}		}	}		speak(YANG);	while (len--) speak(buf[len]);	speak(MARI);}
开发者ID:segfault87,项目名称:SheepCounter,代码行数:30,


示例4: get_lowest_permutation

cube_number_t get_lowest_permutation(cube_number_t number){	cube_number_t i, old = number;	for (i = 10; i < old;i *=10) {		for(cube_number_t scale = 10; scale < old; scale *= 10)			if (DIGIT(number, scale) > DIGIT(number, scale/10))				number = SWITCH_DIGIT(number, scale);	}	return number+i;}
开发者ID:terryyin,项目名称:projecteuler,代码行数:9,


示例5: store_bigint_result

/* Stores an bigint in a bigint result body, either as a 32-bit smallint if it * is in range, or a big integer if not. Clears and frees the passed bigint if * it is not being used. */static void store_bigint_result(MVMP6bigintBody *body, mp_int *i) {    if (can_be_smallint(i)) {        body->u.smallint.flag = MVM_BIGINT_32_FLAG;        body->u.smallint.value = SIGN(i) ? -DIGIT(i, 0) : DIGIT(i, 0);        mp_clear(i);        MVM_free(i);    }    else {        body->u.bigint = i;    }}
开发者ID:baby-gnu,项目名称:MoarVM,代码行数:14,


示例6: vtest

/* do the test on the 2 vectors */static intvtest(arr_t *lhs, int tst, arr_t *rhs){	int cmp;	unsigned int c, i;	for (i = 0, c = MAX(lhs->c, rhs->c) ; i < c ; i++) {		if ((cmp = DIGIT(lhs->v, lhs->c, i) - DIGIT(rhs->v, rhs->c, i)) != 0) {			return result(cmp, tst);		}	}	return result(lhs->revision - rhs->revision, tst);}
开发者ID:prodigeni,项目名称:xbps,代码行数:14,


示例7: match

bool match(char* P, char* T) {    size_t m = strlen(P), n = strlen(T);    HashCode Dm, hashP = 0, hashT = 0;    Dm = prepareDm(m);    for (size_t i = 0; i < m; i++) {        hashP = (hashP*R + DIGIT(P, i)) % M;        hashT = (hashT*R + DIGIT(T, i)) % M;    }    for (size_t k = 0;;) {        if (hashT == hashP && check1by1(P, T, k)) return true;        if (++k>n - m) return false;        else updateHash(hashT, T, m, k, Dm);    }}
开发者ID:telin0411,项目名称:Data_Structures_edX,代码行数:14,


示例8: parse

// Convert a version number string to an array of integers//	12.34.56 -> 56//	"12.34" -> 34//	19" -> 19int parse (char *str, int *result){	int len, i;	char *t, *s, *e, *u;	if (!str)		exit (-1);	len = strlen (str);	if (len < 1)		return 0;	// Start at end: scan backwards for end of number	e = str + len;	for (t = e - 1; t >= str; t--)		if (DIGIT(*t))			break;	// Failed?	if (t < str)	{		printf ("Can't find a number in %s/n", str);		exit (-1);	}		// Now scan back further for start of number, but allow punctuation.	for (s=t, t=t-1; t >= str; s=t--)		if (!VERNUM(*t))			break;#ifdef DEBUG	printf ("So far, e=%s t=%s s=%s/n", e, t, s);#endif	// If first char is not a digit, move forward: ex: joe-1.2 would stop	// on - between joe and 1.   Move forward over it	for (;s<e && PUNCT(*s); s++)		;#ifdef DEBUG	printf ("finally str='%s' s='%s'/n", str, s);#endif	// Now, pull them out, one by one	for (u=s, i=0; i<MAX_COMPONENTS; i++)	{		char *v = u;		long l = strtol (v, &u, 10);		if (u==v)		{			// No more chars we can parse			break;		}		// Accept number		result[i] = l;#ifdef DEBUG		printf ("r[%d]=%d/n", i, result[i]);#endif		// Skip over punctuation		for (u++; u<e && PUNCT(*u); u++)			;	}	return i;}
开发者ID:BackupTheBerlios,项目名称:opendidj,代码行数:64,


示例9: two_complement_bitop

static void two_complement_bitop(mp_int *a, mp_int *b, mp_int *c,        int (*mp_bitop)(mp_int *, mp_int *, mp_int *)) {    mp_int d;    if (SIGN(a) ^ SIGN(b)) {        /* exactly one of them is negative, so need to perform         * some magic. tommath stores a sign bit, but Perl 6 expects         * 2's complement */        mp_init(&d);        if (MP_NEG == SIGN(a)) {            grow_and_negate(a, USED(b), &d);            mp_bitop(&d, b, c);        } else {            grow_and_negate(b, USED(a), &d);            mp_bitop(a, &d, c);        }        if (DIGIT(c, USED(c) - 1) & ((mp_digit)1<<(mp_digit)(DIGIT_BIT - 1))) {            grow_and_negate(c, c->used, &d);            mp_copy(&d, c);            mp_neg(c, c);        }        mp_clear(&d);    } else {        mp_bitop(a, b, c);    }}
开发者ID:mj41,项目名称:MoarVM,代码行数:26,


示例10: is_numeric

spocp_result_tis_numeric(octet_t *op, long *num){	char	*sp;	size_t	l;	long    n;	if (op->val == 0 || *(op->val) == 0)		return SPOCP_SYNTAXERROR;	for ( n = 0L, l = 0, sp = op->val ; l < op->len && DIGIT(*sp) ; l++,sp++) {		if (n)			n *= 10;		n += *sp -'0' ;	}	if (n == LONG_MIN || n == LONG_MAX)		return SPOCP_SYNTAXERROR;	if (l == op->len) {		*num = n;		return SPOCP_SUCCESS;	} else		return SPOCP_SYNTAXERROR;}
开发者ID:Zabrane,项目名称:SPOCP,代码行数:26,


示例11: sum_number

node* sum_number(node *a, node *b){    char sum, carry;    node *head, *end;    // sum each digit    for(head=end=new_digit(-1), sum=carry=0; a || b; a=NEXT(a), b=NEXT(b)){        sum = DIGIT(a) + DIGIT(b) + carry;        carry = sum>9;        end = end->next = new_digit(sum % 10);    }    // add extra digit when applicable    if(carry) end->next = new_digit(carry);    // delete first dummy node    a = head->next;    free(head);    return a;}
开发者ID:0x7ffff,项目名称:Career-Cup-archive,代码行数:16,


示例12: from_num

static void from_num(MVMnum64 d, mp_int *a) {    MVMnum64 d_digit = pow(2, DIGIT_BIT);    MVMnum64 da      = fabs(d);    MVMnum64 upper;    MVMnum64 lower;    MVMnum64 lowest;    MVMnum64 rest;    int      digits  = 0;    mp_zero(a);    while (da > d_digit * d_digit * d_digit) {;        da /= d_digit;        digits++;    }    mp_grow(a, digits + 3);    /* populate the top 3 digits */    upper = da / (d_digit*d_digit);    rest = fmod(da, d_digit*d_digit);    lower = rest / d_digit;    lowest = fmod(rest,d_digit );    if (upper >= 1) {        mp_set_long(a, (unsigned long) upper);        mp_mul_2d(a, DIGIT_BIT , a);        DIGIT(a, 0) = (mp_digit) lower;        mp_mul_2d(a, DIGIT_BIT , a);    } else {        if (lower >= 1) {            mp_set_long(a, (unsigned long) lower);            mp_mul_2d(a, DIGIT_BIT , a);            a->used = 2;        } else {            a->used = 1;        }    }    DIGIT(a, 0) = (mp_digit) lowest;    /* shift the rest */    mp_mul_2d(a, DIGIT_BIT * digits, a);    if (d < 0)        mp_neg(a, a);    mp_clamp(a);    mp_shrink(a);}
开发者ID:baby-gnu,项目名称:MoarVM,代码行数:45,


示例13: mpl_bit_set

mp_err mpl_bit_set(mp_int *a, int bit){  unsigned int ddigit,bbit;  mp_err   res;  //int bob;  ARGCHK(a != NULL, MP_BADARG);  //bob=DIGIT_BIT;  ddigit = bit / DIGIT_BIT;  bbit	 = bit % DIGIT_BIT;  if((res = s_mp_pad(a,ddigit+1)) != MP_OKAY)    return res;  DIGIT(a, ddigit) = DIGIT(a, ddigit) | (1 << bbit);    return MP_OKAY;} 
开发者ID:cran,项目名称:GENLIB,代码行数:19,


示例14: mp_get_int64

/* A forced 64-bit version of mp_get_long, since on some platforms long is * not all that long. */static MVMuint64 mp_get_int64(mp_int * a) {    int i;    MVMuint64 res;    if (a->used == 0) {         return 0;    }    /* get number of digits of the lsb we have to read */    i = MIN(a->used,(int)((sizeof(MVMuint64)*CHAR_BIT+DIGIT_BIT-1)/DIGIT_BIT))-1;    /* get most significant digit of result */    res = DIGIT(a,i);    while (--i >= 0) {        res = (res << DIGIT_BIT) | DIGIT(a,i);    }    return res;}
开发者ID:MattOates,项目名称:MoarVM,代码行数:21,


示例15: mpl_bit_clear

mp_err mpl_bit_clear(mp_int *a, int bit){  unsigned int ddigit,bbit;  ARGCHK(a != NULL, MP_BADARG);  ddigit = bit / DIGIT_BIT;  bbit	 = bit % DIGIT_BIT;  if( ddigit >= USED(a) ) //il faut clear un bit déjà clear...	  return MP_OKAY;  DIGIT(a, ddigit) = DIGIT(a, ddigit) &  ~(1 << bbit);    //Enleve les espace inutiles si requis  s_mp_clamp(a)  return MP_OKAY;} 
开发者ID:cran,项目名称:GENLIB,代码行数:19,


示例16: grow_and_negate

static void grow_and_negate(mp_int *a, int size, mp_int *b) {    int i;    int actual_size = MAX(size, USED(a));    mp_zero(b);    mp_grow(b, actual_size);    USED(b) = actual_size;    for (i = 0; i < actual_size; i++) {        DIGIT(b, i) = (~DIGIT(a, i)) & MP_MASK;    }    mp_add_d(b, 1, b);}
开发者ID:mj41,项目名称:MoarVM,代码行数:11,


示例17: mp_get_int

/* get the lower 32-bits of an mp_int */unsigned long mp_get_int(mp_int *a){   int i;   unsigned long res;   if (a->used == 0) {      return 0;   }   /* get number of digits of the lsb we have to read */   i = MIN(a->used,(int)((sizeof(unsigned long)*CHAR_BIT+DIGIT_BIT-1)/DIGIT_BIT))-1;   /* get most significant digit of result */   res = DIGIT(a,i);   while (--i >= 0) {      res = (res << DIGIT_BIT) | DIGIT(a,i);   }   /* force result to 32-bits always so it is consistent on non 32-bit platforms */   return res & 0xFFFFFFFFUL;}
开发者ID:czurnieden,项目名称:libtommath,代码行数:23,


示例18: grow_and_negate

/* Bitops on libtomath (no 2s compliment API) are horrendously inefficient and * really should be hand-coded to work DIGIT-by-DIGIT with in-loop carry * handling.  For now we have these fixups. * * The following inverts the bits of a negative bigint, adds 1 to that, and * appends sign-bit extension DIGITs to it to give us a 2s compliment * representation in memory.  Do not call it on positive bigints. */static void grow_and_negate(const mp_int *a, int size, mp_int *b) {    int i;    /* Always add an extra DIGIT so we can tell positive values     * with a one in the highest bit apart from negative values.     */    int actual_size = MAX(size, USED(a)) + 1;    SIGN(b) = MP_ZPOS;    mp_grow(b, actual_size);    USED(b) = actual_size;    for (i = 0; i < USED(a); i++) {        DIGIT(b, i) = (~DIGIT(a, i)) & MP_MASK;    }    for (; i < actual_size; i++) {        DIGIT(b, i) = MP_MASK;    }    /* Note: This add cannot cause another grow assuming nobody ever     * tries to use tommath -0 for anything, and nobody tries to use     * this on positive bigints.     */    mp_add_d(b, 1, b);}
开发者ID:baby-gnu,项目名称:MoarVM,代码行数:30,


示例19: ftostr52sp

  // Convert signed float to space-padded string with -_23.4_ format  char* ftostr52sp(const float& x) {    long xx = x * 100;    uint8_t dig;    conv[1] = MINUSOR(xx, RJDIGIT(xx, 10000));    conv[2] = RJDIGIT(xx, 1000);    conv[3] = DIGIMOD(xx, 100);    if ((dig = xx % 10)) {          // second digit after decimal point?      conv[4] = '.';      conv[5] = DIGIMOD(xx, 10);      conv[6] = DIGIT(dig);    }    else {      if ((dig = (xx / 10) % 10)) { // first digit after decimal point?        conv[4] = '.';        conv[5] = DIGIT(dig);      }      else                          // nothing after decimal point        conv[4] = conv[5] = ' ';      conv[6] = ' ';    }    return &conv[1];  }
开发者ID:Moebyus,项目名称:Firmwares,代码行数:24,


示例20: mp_get_int64

/* A forced 64-bit version of mp_get_long, since on some platforms long is * not all that long. */static MVMuint64 mp_get_int64(MVMThreadContext *tc, mp_int * a) {    int i, bits;    MVMuint64 res;    if (a->used == 0) {         return 0;    }    bits = mp_count_bits(a);    if (bits > 64) {        MVM_exception_throw_adhoc(tc, "Cannot unbox %d bit wide bigint into native integer", bits);    }    /* get number of digits of the lsb we have to read */    i = MIN(a->used,(int)((sizeof(MVMuint64)*CHAR_BIT+DIGIT_BIT-1)/DIGIT_BIT))-1;    /* get most significant digit of result */    res = DIGIT(a,i);    while (--i >= 0) {        res = (res << DIGIT_BIT) | DIGIT(a,i);    }    return res;}
开发者ID:kanatohodets,项目名称:MoarVM,代码行数:26,


示例21: ftostr52sp

  // Convert signed float to space-padded string with -_23.4_ format  char* ftostr52sp(const float &f) {    long i = (f * 1000 + (f < 0 ? -5: 5)) / 10;    uint8_t dig;    conv[0] = MINUSOR(i, ' ');    conv[1] = RJDIGIT(i, 10000);    conv[2] = RJDIGIT(i, 1000);    conv[3] = DIGIMOD(i, 100);    if ((dig = i % 10)) {          // second digit after decimal point?      conv[4] = '.';      conv[5] = DIGIMOD(i, 10);      conv[6] = DIGIT(dig);    }    else {      if ((dig = (i / 10) % 10)) { // first digit after decimal point?        conv[4] = '.';        conv[5] = DIGIT(dig);      }      else                          // nothing after decimal point        conv[4] = conv[5] = ' ';      conv[6] = ' ';    }    return conv;  }
开发者ID:szymonrychu,项目名称:Marlin,代码行数:25,


示例22: strtol

longstrtol(	const char *str,	char **ptr,	int use_base){	long val = 0L;	int xx = 0, sign = 1;	if (use_base < 0 || use_base > MBASE)		goto OUT;	while (isspace((unsigned char) *str))		++str;	if (*str == '-') {		++str;		sign = -1;	} else if (*str == '+')		++str;	if (use_base == 0) {		if (*str == '0') {			++str;			if (*str == 'x' || *str == 'X') {				++str;				use_base = 16;			} else				use_base = 8;		} else			use_base = 10;	} else if (use_base == 16)		if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X'))			str += 2;	/*	 * for any base > 10, the digits incrementally following	 * 9 are assumed to be "abc...z" or "ABC...Z"	 */	while (isalnum((unsigned char) *str) && (xx = DIGIT(*str)) < use_base) {		/* accumulate neg avoids surprises near maxint */		val = use_base * val - xx;		++str;	}OUT:	if (ptr != NULL)		*ptr = str;	return (sign * (-val));}
开发者ID:OS2World,项目名称:APP-INTERNET-Tin,代码行数:46,


示例23: fill

/* Fill square with given digit, and update state. * Returns 0 on success, else -1 on error (i.e. invalid fill) */staticintfill( int idx, int digit ){    assert( 0 != digit );    if( !IS_EMPTY( idx ) )        return ( DIGIT( idx ) == digit ) ? 0 : -1;    if( DISALLOWED( idx, digit ) )        return -1;    board[ idx ] = SET_DIGIT( digit );    update( idx );    add_move( idx, digit, 0 );    return 0;}
开发者ID:BurntBrunch,项目名称:rockbox-fft,代码行数:21,


示例24: mpp_random

mp_err  mpp_random(mp_int *a){  mp_digit  next = 0;  unsigned int       ix, jx;  ARGCHK(a != NULL, MP_BADARG);  for(ix = 0; ix < USED(a); ix++) {    for(jx = 0; jx < sizeof(mp_digit); jx++) {      next = (next << CHAR_BIT) | (RANDOM() & UCHAR_MAX);    }    DIGIT(a, ix) = next;  }  return MP_OKAY;} /* end mpp_random() */
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:18,


示例25: two_complement_bitop

static void two_complement_bitop(mp_int *a, mp_int *b, mp_int *c,				 int (*mp_bitop)(mp_int *, mp_int *, mp_int *)) {    mp_int d;    mp_int e;    mp_int *f;    mp_int *g;    f = a;    g = b;    if (MP_NEG == SIGN(a)) {        mp_init(&d);        grow_and_negate(a, USED(b), &d);        f = &d;    }    if (MP_NEG == SIGN(b)) {        mp_init(&e);        grow_and_negate(b, USED(a), &e);        g = &e;    }    /* f and g now guaranteed to each point to positive bigints containing     * a 2s compliment representation of the values in a and b.  If either     * a or b was negative, the representation is one tomath "digit" longer     * than it need be and sign extended.     */    mp_bitop(f, g, c);    if (f == &d) mp_clear(&d);    if (g == &e) mp_clear(&e);    /* Use the fact that tomath clamps to detect results that should be     * signed.  If we created extra tomath "digits" and they resulted in     * sign bits of 0, they have been clamped away.  If the resulting sign     * bits were 1, they remain, and c will have more digits than either of     * original operands.  Note this only works because we do not     * support NOR/NAND/NXOR, and so two zero sign bits can never create 1s.     */    if (USED(c) > MAX(USED(a),USED(b))) {        int i;        for (i = 0; i < USED(c); i++) {            DIGIT(c, i) = (~DIGIT(c, i)) & MP_MASK;        }        mp_add_d(c, 1, c);	mp_neg(c, c);    }}
开发者ID:baby-gnu,项目名称:MoarVM,代码行数:44,


示例26: ESPORD

Word ESPORD(){       Word i,n,m,C,H,H1,H11;Step1: /* Read in the number of variables. */       do C = CREAD(); while (!DIGIT(C));       BKSP(); n = GREAD() - 1;       FILINE();       FILINE();Step2: /* Read in the rows. */       H = NIL;       for (;;)         {         C = CREAD(); BKSP(); if (C == '.')  break;         H1 = NIL;         for (i=1; i<=n; i++)           {           m = GREAD();           switch(m)             {             case   1: H11 = GTOP;  break;              case  10: H11 = EQOP;  break;              case  11: H11 = GEOP;  break;              case 100: H11 = LTOP;  break;              case 101: H11 = NEOP;  break;              case 110: H11 = LEOP;  break;             case 111: H11 = TAOP;  break;              default: FAIL("ESPORD","Illegal output from espresso.");             }           H1 = COMP(H11,H1);           }         FILINE();         H1 = INV(H1);         H = COMP(H1,H);                  }       H = INV(H);       FILINE();Return: /* Prepare for return. */       return(H);}
开发者ID:fchapoton,项目名称:qepcad-1,代码行数:42,


示例27: update

/* Update board state after setting a digit (clearing not handled) */staticvoidupdate( int idx ){    const int row = ROW( idx );    const int col = COLUMN( idx );    const int block = IDX_BLOCK( row, col );    const int mask = DIGIT_STATE( DIGIT( idx ) );    int i;    board[ idx ] |= STATE_MASK;  /* filled - no choice possible */    /* Digit cannot appear in row, column or block */    for( i = 0 ; i < 9 ; ++i )    {        board[ idx_row( row, i ) ] |= mask;        board[ idx_column( col, i ) ] |= mask;        board[ idx_block( block, i ) ] |= mask;    }}
开发者ID:BurntBrunch,项目名称:rockbox-fft,代码行数:22,


示例28: buf_putmpint

/* for our purposes we only need positive (or 0) numbers, so will * fail if we get negative numbers */void buf_putmpint(buffer* buf, mp_int * mp) {	unsigned int len, pad = 0;	TRACE2(("enter buf_putmpint"))	dropbear_assert(mp != NULL);	if (SIGN(mp) == MP_NEG) {		dropbear_exit("negative bignum");	}	/* zero check */	if (USED(mp) == 1 && DIGIT(mp, 0) == 0) {		len = 0;	} else {		/* SSH spec requires padding for mpints with the MSB set, this code		 * implements it */		len = mp_count_bits(mp);		/* if the top bit of MSB is set, we need to pad */		pad = (len%8 == 0) ? 1 : 0;		len = len / 8 + 1; /* don't worry about rounding, we need it for							  padding anyway when len%8 == 0 */	}	/* store the length */	buf_putint(buf, len);		/* store the actual value */	if (len > 0) {		if (pad) {			buf_putbyte(buf, 0x00);		}		if (mp_to_unsigned_bin(mp, buf_getwriteptr(buf, len-pad)) != MP_OKAY) {			dropbear_exit("mpint error");		}		buf_incrwritepos(buf, len-pad);	}	TRACE2(("leave buf_putmpint"))}
开发者ID:CoffeMug,项目名称:dropbear,代码行数:43,


示例29: exblock

/* Worker for block() */staticvoidexblock( int block, int el, int (*idx_fn)( int, int ) ){    int i, idx, mask;    rb->yield();    /* By assumption, all unknown squares in the block appear in the     * same row/column, so to construct a mask for these squares, it     * is sufficient to invert the mask for the known squares in the     * block.     */    mask = 0;    for( i = 0 ; i < 9 ; ++i )    {        idx = idx_block( block, i );        if( !IS_EMPTY( idx ) )            mask |= DIGIT_STATE( DIGIT( idx ) );    }    exmask( mask ^ STATE_MASK, block, el, idx_fn );}
开发者ID:BurntBrunch,项目名称:rockbox-fft,代码行数:23,


示例30: mp_count_bits

/* returns the number of bits in an int */intmp_count_bits (mp_int * a){  int     r;  mp_digit q;  /* shortcut */  if (USED(a) == 0) {    return 0;  }  /* get number of digits and add that */  r = (USED(a) - 1) * DIGIT_BIT;    /* take the last digit and count the bits in it */  q = DIGIT(a,USED(a) - 1);  while (q > ((mp_digit) 0)) {    ++r;    q >>= ((mp_digit) 1);  }  return r;}
开发者ID:asr,项目名称:uhc,代码行数:23,



注:本文中的DIGIT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ DIMOF函数代码示例
C++ DIFF_TICK函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。