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

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

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

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

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

示例1: gen_basis

voidgen_basis(){	int k, m;	short blk[64];	printf("u_int dct_basis[64][64/sizeof(u_int)] = {/n");	for (k = 0; k < 64; ++k) {		printf("{");		memset((char*)blk, 0, sizeof(blk));		blk[COLZAG[k]] = FIX(1);		v_rdct(blk);		for (m = 0; m < 64; ) {			printf("%d,%d,/n",			       find(multab, nmul, blk[m+0]) << 24 |			       find(multab, nmul, blk[m+1]) << 16 |			       find(multab, nmul, blk[m+2]) << 8 |			       find(multab, nmul, blk[m+3]),			       find(multab, nmul, blk[m+4]) << 24 |			       find(multab, nmul, blk[m+5]) << 16 |			       find(multab, nmul, blk[m+6]) << 8 |			       find(multab, nmul, blk[m+7]));			m += 8;		}		printf("},/n");	}	printf("};/n/n");}
开发者ID:usamaaftab80,项目名称:multi-p2p,代码行数:28,


示例2: pkcs11_mechanism_list

voidpkcs11_mechanism_list(FILE * outfile, const char *url, unsigned int flags,		      common_info_st * info){	int ret;	int idx;	unsigned long mechanism;	const char *str;	pkcs11_common(info);	FIX(url, outfile, 0, info);	idx = 0;	do {		ret =		    gnutls_pkcs11_token_get_mechanism(url, idx++,						      &mechanism);		if (ret >= 0) {			str = NULL;			if (mechanism <=			    sizeof(mech_list) / sizeof(mech_list[0]))				str = mech_list[mechanism];			if (str == NULL)				str = "UNKNOWN";			fprintf(outfile, "[0x%.4lx] %s/n", mechanism, str);		}	}	while (ret >= 0);	return;}
开发者ID:attilamolnar,项目名称:gnutls,代码行数:34,


示例3: adsr

// shouldn't need to check alive bit - never called for dead voices (no zombie channels possible)// FIXME: bloatint adsr(const AdsrParams* params, AdsrState* state) {	int out = state->value;	// TODO: use time constant to precalc coefs, skip to next if value == zing	// TODO: precalculate coefficients g = 1 - exp(1/(T*fs))	// TODO: use linear ramp at attack stage?	state->value = lowpass_juttu(state->currentcoef, state->nextvalue);	if (++state->time >= state->nexttime) {		switch (state->section) {			case ADSR_ATTACK:				state->currentcoef = params->decay;				state->nextvalue = params->sustain;				break;			case ADSR_DECAY:				state->currentcoef = FIX(1);				state->value = params->sustain; // TODO: do i need this when it has went there already				break;			case ADSR_SUSTAIN:				state->currentcoef = params->release;				break;			case ADSR_RELEASE:				break;			default:				assert(0); // no zombie channels		}		state->nexttime = params->nexttime[state->section];		state->section++;	}	return out;}
开发者ID:sooda,项目名称:spankmoog,代码行数:31,


示例4: S_cputime

ptr S_cputime(void) {  struct timespec tp;  s_gettime(time_process, &tp);  return S_add(S_mul(S_integer_time_t(tp.tv_sec), FIX(1000)),               Sinteger((tp.tv_nsec + 500000) / 1000000));}
开发者ID:1u4nx,项目名称:ChezScheme,代码行数:7,


示例5: pkcs11_get_random

voidpkcs11_get_random(FILE * outfile, const char *url, unsigned bytes,		  common_info_st * info){	int ret;	uint8_t *output;	pkcs11_common(info);	FIX(url, outfile, 0, info);	output = malloc(bytes);	if (output == NULL) {		fprintf(stderr, "Memory error/n");		exit(1);	}	ret = gnutls_pkcs11_token_get_random(url, output, bytes);	if (ret < 0) {		fprintf(stderr, "gnutls_pkcs11_token_get_random: %s/n",			gnutls_strerror(ret));		exit(1);	}	fwrite(output, 1, bytes, outfile);	return;}
开发者ID:attilamolnar,项目名称:gnutls,代码行数:28,


示例6: getgr_r

static int getgr_r(const char *name, gid_t gid, struct group *gr, char *buf, size_t size, struct group **res){	FILE *f;	char *line = 0;	size_t len = 0;	char **mem = 0;	size_t nmem = 0;	int rv = 0;	size_t i;	int cs;	pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);	f = fopen("/etc/group", "rbe");	if (!f) {		rv = errno;		goto done;	}	*res = 0;	while (__getgrent_a(f, gr, &line, &len, &mem, &nmem)) {		if (name && !strcmp(name, gr->gr_name)		|| !name && gr->gr_gid == gid) {			if (size < len + (nmem+1)*sizeof(char *) + 32) {				rv = ERANGE;				break;			}			*res = gr;			buf += (16-(uintptr_t)buf)%16;			gr->gr_mem = (void *)buf;			buf += (nmem+1)*sizeof(char *);			memcpy(buf, line, len);			FIX(name);			FIX(passwd);			for (i=0; mem[i]; i++)				gr->gr_mem[i] = mem[i]-line+buf;			gr->gr_mem[i] = 0;			break;		}	} 	free(mem); 	free(line);	fclose(f);done:	pthread_setcancelstate(cs, 0);	return rv;}
开发者ID:4ian,项目名称:emscripten,代码行数:47,


示例7: libnet_insert_ipo

intlibnet_insert_ipo(struct ipoption *opt, u_char opt_len, u_char *buf){    struct libnet_ip_hdr *ip_hdr;    u_char *p;    u_short s, j;    u_char i;    if (!buf)    {        return (-1);    }    ip_hdr = (struct libnet_ip_hdr *)(buf);    s = UNFIX(ip_hdr->ip_len);    if ((s + opt_len) > IP_MAXPACKET)    {        /*         *  Nope.  Too big.         */#if (__DEBUG)        libnet_error(LIBNET_ERR_WARNING,                     "insert_ipo: options list would result in too large of a packet/n");#endif        return (-1);    }    /*     *  Do we have more then just an IP header?     */    if (s > LIBNET_IP_H)    {        /*         *  Move over whatever's in the way.         */        memmove((u_char *)ip_hdr + LIBNET_IP_H + opt_len, (u_char *)ip_hdr                + LIBNET_IP_H, opt_len);    }    /*     *  Copy over option list.  We rely on the programmer having been     *  smart enough to allocate enough heap memory here.  Uh oh.     */    p = (u_char *)ip_hdr + LIBNET_IP_H;    memcpy(p, opt->ipopt_list, opt_len);    /*     *  Count up number of 32-bit words in options list, padding if     *  neccessary.     */    for (i = 0, j = 0; i < opt_len; i++) (i % 4) ? j : j++;    ip_hdr->ip_hl   += j;    ip_hdr->ip_len  = FIX(opt_len + s);    return (1);}
开发者ID:niranjan-nagaraju,项目名称:frel,代码行数:58,


示例8: start_pass_merged_upsample

METHODDEF voidstart_pass_merged_upsample (j_decompress_ptr cinfo){  my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;  INT32 i, x2;  SHIFT_TEMPS  /* Mark the spare buffer empty */  upsample->spare_full = FALSE;  /* Initialize total-height counter for detecting bottom of image */  upsample->rows_to_go = cinfo->output_height;  /* Initialize the YCC=>RGB conversion tables.   * This is taken directly from jdcolor.c; see that file for more info.   */  upsample->Cr_r_tab =    (int *)alloc_small_wrapper((j_common_ptr) cinfo, JPOOL_IMAGE,				(MAXJSAMPLE+1) * SIZEOF(int));  upsample->Cb_b_tab =    (int *)alloc_small_wrapper((j_common_ptr) cinfo, JPOOL_IMAGE,				(MAXJSAMPLE+1) * SIZEOF(int));  upsample->Cr_g_tab =  (INT32 *)alloc_small_wrapper((j_common_ptr) cinfo, JPOOL_IMAGE,				(MAXJSAMPLE+1) * SIZEOF(INT32));  upsample->Cb_g_tab =    (INT32 *)alloc_small_wrapper((j_common_ptr) cinfo, JPOOL_IMAGE,                                 (MAXJSAMPLE+1) * SIZEOF(INT32));  for (i = 0; i <= MAXJSAMPLE; i++) {    /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */    /* The Cb or Cr value we are thinking of is x = i - MAXJSAMPLE/2 */    x2 = 2*i - MAXJSAMPLE;	/* twice x */    /* Cr=>R value is nearest int to 1.40200 * x */    upsample->Cr_r_tab[i] = (int)		    RIGHT_SHIFT(FIX(1.40200/2) * x2 + ONE_HALF, SCALEBITS);    /* Cb=>B value is nearest int to 1.77200 * x */    upsample->Cb_b_tab[i] = (int)		    RIGHT_SHIFT(FIX(1.77200/2) * x2 + ONE_HALF, SCALEBITS);    /* Cr=>G value is scaled-up -0.71414 * x */    upsample->Cr_g_tab[i] = (- FIX(0.71414/2)) * x2;    /* Cb=>G value is scaled-up -0.34414 * x */    /* We also add in ONE_HALF so that need not do it in inner loop */    upsample->Cb_g_tab[i] = (- FIX(0.34414/2)) * x2 + ONE_HALF;  }}
开发者ID:8l,项目名称:csolve,代码行数:45,


示例9: getrlimit

int getrlimit(int resource, struct rlimit *rlim){	unsigned long k_rlim[2];	int ret = syscall(SYS_prlimit64, 0, resource, 0, mcfi_sandbox_mask(rlim));	if (!ret) {		FIX(rlim->rlim_cur);		FIX(rlim->rlim_max);	}	if (!ret || errno != ENOSYS)		return ret;	if (syscall(SYS_getrlimit, resource, mcfi_sandbox_mask(k_rlim)) < 0)		return -1;	rlim->rlim_cur = k_rlim[0] == -1UL ? RLIM_INFINITY : k_rlim[0];	rlim->rlim_max = k_rlim[1] == -1UL ? RLIM_INFINITY : k_rlim[1];	FIX(rlim->rlim_cur);	FIX(rlim->rlim_max);	return 0;}
开发者ID:mcfi,项目名称:MCFI,代码行数:18,


示例10: TIFFYCbCrToRGBInit

/* * Initialize the YCbCr->RGB conversion tables.  The conversion * is done according to the 6.0 spec: * *    R = Y + Cr*(2 - 2*LumaRed) *    B = Y + Cb*(2 - 2*LumaBlue) *    G =   Y *    - LumaBlue*Cb*(2-2*LumaBlue)/LumaGreen *    - LumaRed*Cr*(2-2*LumaRed)/LumaGreen * * To avoid floating point arithmetic the fractional constants that * come out of the equations are represented as fixed point values * in the range 0...2^16.  We also eliminate multiplications by * pre-calculating possible values indexed by Cb and Cr (this code * assumes conversion is being done for 8-bit samples). */static voidTIFFYCbCrToRGBInit(TIFFYCbCrToRGB* ycbcr, TIFF* tif){    TIFFRGBValue* clamptab;    float* coeffs;    int i;    clamptab = (TIFFRGBValue*)(    (tidata_t) ycbcr+TIFFroundup(sizeof (TIFFYCbCrToRGB), sizeof (long)));    _TIFFmemset(clamptab, 0, 256);  /* v < 0 => 0 */    ycbcr->clamptab = (clamptab += 256);    for (i = 0; i < 256; i++)    clamptab[i] = i;    _TIFFmemset(clamptab+256, 255, 2*256);  /* v > 255 => 255 */    TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRCOEFFICIENTS, &coeffs);    _TIFFmemcpy(ycbcr->coeffs, coeffs, 3*sizeof (float));    { float f1 = 2-2*LumaRed;       int32 D1 = FIX(f1);      float f2 = LumaRed*f1/LumaGreen;  int32 D2 = -FIX(f2);      float f3 = 2-2*LumaBlue;      int32 D3 = FIX(f3);      float f4 = LumaBlue*f3/LumaGreen; int32 D4 = -FIX(f4);      int x;      ycbcr->Cr_r_tab = (int*) (clamptab + 3*256);      ycbcr->Cb_b_tab = ycbcr->Cr_r_tab + 256;      ycbcr->Cr_g_tab = (int32*) (ycbcr->Cb_b_tab + 256);      ycbcr->Cb_g_tab = ycbcr->Cr_g_tab + 256;      /*       * i is the actual input pixel value in the range 0..255       * Cb and Cr values are in the range -128..127 (actually       * they are in a range defined by the ReferenceBlackWhite       * tag) so there is some range shifting to do here when       * constructing tables indexed by the raw pixel data.       *       * XXX handle ReferenceBlackWhite correctly to calculate       *     Cb/Cr values to use in constructing the tables.       */      for (i = 0, x = -128; i < 256; i++, x++) {      ycbcr->Cr_r_tab[i] = (int)((D1*x + ONE_HALF)>>SHIFT);      ycbcr->Cb_b_tab[i] = (int)((D3*x + ONE_HALF)>>SHIFT);      ycbcr->Cr_g_tab[i] = D2*x;      ycbcr->Cb_g_tab[i] = D4*x + ONE_HALF;      }    }}
开发者ID:OS2World,项目名称:DEV-UTIL-MGL,代码行数:60,


示例11: pkcs11_generate

voidpkcs11_generate(FILE * outfile, const char *url, gnutls_pk_algorithm_t pk,		unsigned int bits,		const char *label, const char *id, int detailed,		unsigned int flags, common_info_st * info){	int ret;	gnutls_datum_t pubkey;	gnutls_datum_t cid = {NULL, 0};	unsigned char raw_id[128];	size_t raw_id_size;	pkcs11_common(info);	FIX(url, outfile, detailed, info);	CHECK_LOGIN_FLAG(flags);	if (id != NULL) {		raw_id_size = sizeof(raw_id);		ret = gnutls_hex2bin(id, strlen(id), raw_id, &raw_id_size);		if (ret < 0) {			fprintf(stderr, "Error converting hex: %s/n", gnutls_strerror(ret));			exit(1);		}		cid.data = raw_id;		cid.size = raw_id_size;	}	if (outfile == stderr || outfile == stdout) {		fprintf(stderr, "warning: no --outfile was specified and the generated public key will be printed on screen./n");	}	if (label == NULL && info->batch == 0) {		label = read_str("warning: Label was not specified./nLabel: ");	}	ret =	    gnutls_pkcs11_privkey_generate3(url, pk, bits, label, &cid,					    GNUTLS_X509_FMT_PEM, &pubkey,					    info->key_usage,					    flags);	if (ret < 0) {		fprintf(stderr, "Error in %s:%d: %s/n", __func__, __LINE__,			gnutls_strerror(ret));		if (bits != 1024 && pk == GNUTLS_PK_RSA)			fprintf(stderr,				"note: several smart cards do not support arbitrary size keys; try --bits 1024 or 2048./n");		exit(1);	}	fwrite(pubkey.data, 1, pubkey.size, outfile);	gnutls_free(pubkey.data);	UNFIX;	return;}
开发者ID:attilamolnar,项目名称:gnutls,代码行数:56,


示例12: S_alloc_init

void S_alloc_init() {    ISPC s; IGEN g; UINT i;    if (S_boot_time) {      /* reset the allocation tables */        for (s = 0; s <= max_real_space; s++) {            for (g = 0; g <= static_generation; g++) {                S_G.base_loc[s][g] = FIX(0);                S_G.first_loc[s][g] = FIX(0);                S_G.next_loc[s][g] = FIX(0);                S_G.bytes_left[s][g] = 0;                S_G.bytes_of_space[s][g] = 0;            }        }        /* initialize the dirty-segment lists. */        for (i = 0; i < DIRTY_SEGMENT_LISTS; i += 1) {          S_G.dirty_segments[i] = NULL;        }        S_G.collect_trip_bytes = default_collect_trip_bytes;       /* set to final value in prim.c when known */        S_protect(&S_G.nonprocedure_code);        S_G.nonprocedure_code = FIX(0);        S_protect(&S_G.null_vector);        find_room(space_new, 0, type_typed_object, size_vector(0), S_G.null_vector);        VECTTYPE(S_G.null_vector) = (0 << vector_length_offset) | type_vector;        S_protect(&S_G.null_fxvector);        find_room(space_new, 0, type_typed_object, size_fxvector(0), S_G.null_fxvector);        FXVECTOR_TYPE(S_G.null_fxvector) = (0 << fxvector_length_offset) | type_fxvector;        S_protect(&S_G.null_bytevector);        find_room(space_new, 0, type_typed_object, size_bytevector(0), S_G.null_bytevector);        BYTEVECTOR_TYPE(S_G.null_bytevector) = (0 << bytevector_length_offset) | type_bytevector;        S_protect(&S_G.null_string);        find_room(space_new, 0, type_typed_object, size_string(0), S_G.null_string);        STRTYPE(S_G.null_string) = (0 << string_length_offset) | type_string;    }}
开发者ID:cisco,项目名称:ChezScheme,代码行数:43,


示例13: rgb_to_yuv

QColor inline rgb_to_yuv(const QColor &original){    int r = original.red();    int g = original.green();    int b = original.blue();    int a = original.alpha();    int y = (FIX(0.299) * r + FIX(0.587) * g +             FIX(0.114) * b + ONE_HALF) >> SCALEBITS;    int u = ((- FIX(0.169) * r - FIX(0.331) * g +             FIX(0.499) * b + ONE_HALF) >> SCALEBITS) + 128;    int v = ((FIX(0.499) * r - FIX(0.418) * g -             FIX(0.0813) * b + ONE_HALF) >> SCALEBITS) + 128;    return QColor(y, u, v, a);}
开发者ID:JGunning,项目名称:OpenAOL-TV,代码行数:16,


示例14: libnet_write_ip

intlibnet_write_ip(int sock, u_char *buf, int len){    int c;    struct sockaddr_in sin;    struct libnet_ip_hdr  *ip_hdr;    ip_hdr = (struct libnet_ip_hdr *)buf;#if (LIBNET_BSD_BYTE_SWAP)    /*     *  For link access, we don't need to worry about the inconsistencies of     *  certain BSD kernels.  However, raw socket nuances abound.  Certain     *  BSD implmentations require the ip_len and ip_off fields to be in host     *  byte order.  It's MUCH easier to change it here than inside the bpf     *  writing routine.     */    ip_hdr->ip_len = FIX(ip_hdr->ip_len);    ip_hdr->ip_off = FIX(ip_hdr->ip_off);#endif    memset(&sin, 0, sizeof(struct sockaddr_in));    sin.sin_family  = AF_INET;    sin.sin_addr.s_addr = ip_hdr->ip_dst.s_addr;    c = sendto(sock, buf, len, 0, (struct sockaddr *)&sin,        sizeof(struct sockaddr));#if (LIBNET_BSD_BYTE_SWAP)    ip_hdr->ip_len = UNFIX(ip_hdr->ip_len);    ip_hdr->ip_off = UNFIX(ip_hdr->ip_off);#endif                 if (c != len)    {#if (__DEBUG)        libnet_error(LIBNET_ERR_WARNING, "write_ip: %d bytes written (%s)/n",                c, strerror(errno));#endif    }    return (c);}
开发者ID:ebichu,项目名称:dd-wrt,代码行数:42,


示例15: main

int main(void) {	int n, s, t;	int i, j;	scanf("%d%d", &n, &s);	for (i = 1; i <= n; ++i) {		for (j = 1; j < i; ++j) {			printf("  ");		}		printf("%d", s);		t = s;		for (j = i; j < n; ++j) {			t = FIX(t + j);			printf(" %d", t);		}		printf("/n");		s = FIX(s + i + 1);	}	return 0;}
开发者ID:RC1140,项目名称:paulzcycoding,代码行数:20,


示例16: Yuv2Rgb

static void Yuv2Rgb( uint8_t *r, uint8_t *g, uint8_t *b, int y1, int u1, int v1 ){    /* macros used for YUV pixel conversions */#   define SCALEBITS 10#   define ONE_HALF  (1 << (SCALEBITS - 1))#   define FIX(x)    ((int) ((x) * (1<<SCALEBITS) + 0.5))    int y, cb, cr, r_add, g_add, b_add;    cb = u1 - 128;    cr = v1 - 128;    r_add = FIX(1.40200*255.0/224.0) * cr + ONE_HALF;    g_add = - FIX(0.34414*255.0/224.0) * cb            - FIX(0.71414*255.0/224.0) * cr + ONE_HALF;    b_add = FIX(1.77200*255.0/224.0) * cb + ONE_HALF;    y = (y1 - 16) * FIX(255.0/219.0);    *r = vlc_uint8( (y + r_add) >> SCALEBITS );    *g = vlc_uint8( (y + g_add) >> SCALEBITS );    *b = vlc_uint8( (y + b_add) >> SCALEBITS );#undef FIX}
开发者ID:Aki-Liang,项目名称:vlc-2.1.0.oldlib-2010,代码行数:21,


示例17: InitColorDither

voidInitColorDither(){    int CR, CB, i;    Cr_b_tab = (int *)malloc(256*sizeof(int));    Cr_g_tab = (int *)malloc(256*sizeof(int));    Cb_g_tab = (int *)malloc(256*sizeof(int));    Cb_r_tab = (int *)malloc(256*sizeof(int));    for (i=0; i<256; i++) {	CB = CR = i;	CB -= 128; CR -= 128;	Cb_r_tab[i] = FIX(1.40200) * CB;	Cr_g_tab[i] = -FIX(0.34414) * CR;	Cb_g_tab[i] = -FIX(0.71414) * CB;   	Cr_b_tab[i] = FIX(1.77200) * CR;    }}
开发者ID:LambdaCalculus379,项目名称:SLS-1.02,代码行数:21,


示例18: getpw_r

static int getpw_r(const char *name, uid_t uid, struct passwd *pw, char *buf, size_t size, struct passwd **res){	FILE *f;	char *line = 0;	size_t len = 0;	int rv = 0;	int cs;	pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);	f = fopen("/etc/passwd", "rb");	if (!f) {		rv = errno;		goto done;	}	*res = 0;	while (__getpwent_a(f, pw, &line, &len)) {		if (name && !strcmp(name, pw->pw_name)		|| !name && pw->pw_uid == uid) {			if (size < len) {				rv = ERANGE;				break;			}			*res = pw;			memcpy(buf, line, len);			FIX(name);			FIX(passwd);			FIX(gecos);			FIX(dir);			FIX(shell);			break;		}	} 	free(line);	fclose(f);done:	pthread_setcancelstate(cs, 0);	return rv;}
开发者ID:KGG814,项目名称:AOS,代码行数:40,


示例19: yuv_to_rgb

static inline void yuv_to_rgb( uint8_t *r, uint8_t *g, uint8_t *b,                              uint8_t y1, uint8_t u1, uint8_t v1 ){    /* macros used for YUV pixel conversions */#   define SCALEBITS 10#   define ONE_HALF  (1 << (SCALEBITS - 1))#   define FIX(x)    ((int) ((x) * (1<<SCALEBITS) + 0.5))#   define CLAMP( x ) (((x) > 255) ? 255 : ((x) < 0) ? 0 : (x));    int y, cb, cr, r_add, g_add, b_add;    cb = u1 - 128;    cr = v1 - 128;    r_add = FIX(1.40200*255.0/224.0) * cr + ONE_HALF;    g_add = - FIX(0.34414*255.0/224.0) * cb        - FIX(0.71414*255.0/224.0) * cr + ONE_HALF;    b_add = FIX(1.77200*255.0/224.0) * cb + ONE_HALF;    y = (y1 - 16) * FIX(255.0/219.0);    *r = CLAMP((y + r_add) >> SCALEBITS);    *g = CLAMP((y + g_add) >> SCALEBITS);    *b = CLAMP((y + b_add) >> SCALEBITS);}
开发者ID:Nevcairiel,项目名称:atmowin,代码行数:22,


示例20: ternarylook_fix_direct_implications

inline int ternarylook_fix_direct_implications( const int parent, const int reference ){        int i, lit1, lit2, *tImp = TernaryImp[ parent ];        for( i = TernaryImpSize[ parent ]; i > 0; i-- )        {            lit1 = *(tImp++);            lit2 = *(tImp++);	    if( lit1 == reference )	    {	    	if( IS_FIXED(lit2) ) { if( FIXED_ON_COMPLEMENT(lit2) ) return UNSAT; }		else{ FIX( lit2, currentTimeStamp ); *(look_fixstackp++) = lit2; }	    }	    else if( lit2 == reference )	    {	    	if( IS_FIXED(lit1) ) { if( FIXED_ON_COMPLEMENT(lit1) ) return UNSAT; }		else{ FIX( lit1, currentTimeStamp ); *(look_fixstackp++) = lit1; }	    }        }	return SAT;}
开发者ID:xxyzzzq,项目名称:open-wbo,代码行数:22,


示例21: S_thread_init

void S_thread_init() {  if (S_boot_time) {    S_protect(&S_G.threadno);    S_G.threadno = FIX(0);#ifdef PTHREADS   /* this is also reset in main.c after heap restoration */    s_thread_mutex_init(&S_tc_mutex.pmutex);    S_tc_mutex.owner = s_thread_self();    S_tc_mutex.count = 0;    s_thread_cond_init(&S_collect_cond);    S_tc_mutex_depth = 0;#endif /* PTHREADS */  }}
开发者ID:Saigut,项目名称:ChezScheme,代码行数:15,


示例22: S_realtime

ptr S_realtime(void) {  struct timespec tp;  time_t sec; I32 nsec;  s_gettime(time_monotonic, &tp);  sec = tp.tv_sec - starting_mono_tp.tv_sec;  nsec = tp.tv_nsec - starting_mono_tp.tv_nsec;  if (nsec < 0) {    sec -= 1;    nsec += 1000000000;  }  return S_add(S_mul(S_integer_time_t(sec), FIX(1000)),               Sinteger((nsec + 500000) / 1000000));}
开发者ID:1u4nx,项目名称:ChezScheme,代码行数:15,


示例23: build_ycc_rgb_table

build_ycc_rgb_table (j_decompress_ptr cinfo){  my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;  int i;  INT32 x;  SHIFT_TEMPS  upsample->Cr_r_tab = (int *)    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,                                (MAXJSAMPLE+1) * sizeof(int));  upsample->Cb_b_tab = (int *)    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,                                (MAXJSAMPLE+1) * sizeof(int));  upsample->Cr_g_tab = (INT32 *)    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,                                (MAXJSAMPLE+1) * sizeof(INT32));  upsample->Cb_g_tab = (INT32 *)    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,                                (MAXJSAMPLE+1) * sizeof(INT32));  for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {    /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */    /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */    /* Cr=>R value is nearest int to 1.40200 * x */    upsample->Cr_r_tab[i] = (int)                    RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);    /* Cb=>B value is nearest int to 1.77200 * x */    upsample->Cb_b_tab[i] = (int)                    RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);    /* Cr=>G value is scaled-up -0.71414 * x */    upsample->Cr_g_tab[i] = (- FIX(0.71414)) * x;    /* Cb=>G value is scaled-up -0.34414 * x */    /* We also add in ONE_HALF so that need not do it in inner loop */    upsample->Cb_g_tab[i] = (- FIX(0.34414)) * x + ONE_HALF;  }}
开发者ID:dwbuiten,项目名称:mozjpeg,代码行数:36,


示例24: aes_call_be32

voidaes_call_be32(AESPB * apb){  int          i;  short *      tmp_short;  long *       tmp_long;  static short contrl[5];  static short global[15];  static short intin[16];  static short intout[7];  static long  addrin[3];  static long  addrout[1];  static AESPB native_apb =  {    contrl, global, intin, intout, addrin, addrout  };  tmp_short = (short *)ntohl((LONG)apb->contrl);  FIX(native_apb.contrl, tmp_short, 5, ntohs);  tmp_short = (short *)ntohl((LONG)apb->intin);  FIX(native_apb.intin, tmp_short, native_apb.contrl[1], ntohs);  tmp_long = (long *)ntohl((LONG)apb->addrin);  FIX(native_apb.addrin, tmp_long, native_apb.contrl[2], ntohl);  aes_call(&native_apb);  tmp_short = (short *)ntohl((LONG)apb->contrl);  FIX(tmp_short, native_apb.contrl, 5, htons);  tmp_short = (short *)ntohl((LONG)apb->intout);  FIX(tmp_short, native_apb.intout, 7 /* FIXME native_apb.contrl[3] */, htons);  tmp_long = (long *)ntohl((LONG)apb->addrout);  FIX(tmp_long, native_apb.addrout, 1 /* FIXME native_apb.contrl[4] */, htonl);  if((native_apb.contrl[0] == 23) || /* evnt_mesag */     (native_apb.contrl[0] == 25))   /* evnt_multi */  {    DEBUG3("Fix evnt_multi");    if(native_apb.addrin[0] != 0)    {                FIX((WORD *)native_apb.addrin[0],          (WORD *)native_apb.addrin[0],          (MSG_LENGTH / sizeof(WORD)),          htons);    }    DEBUG3("Fix evnt_multi finished");  }}
开发者ID:e8johan,项目名称:oaesis,代码行数:51,


示例25: pkcs11_export_pubkey

voidpkcs11_export_pubkey(FILE * outfile, const char *url, int detailed, unsigned int flags, common_info_st * info){	int ret;	gnutls_datum_t pubkey;	gnutls_pkcs11_privkey_t pkey;	pkcs11_common(info);	FIX(url, outfile, detailed, info);	CHECK_LOGIN_FLAG(flags);	if (outfile == stderr || outfile == stdout) {		fprintf(stderr, "warning: no --outfile was specified and the public key will be printed on screen./n");		sleep(3);	}	ret = gnutls_pkcs11_privkey_init(&pkey);	if (ret < 0) {		fprintf(stderr, "Error in %s:%d: %s/n", __func__, __LINE__,			gnutls_strerror(ret));		exit(1);	}	ret = gnutls_pkcs11_privkey_import_url(pkey, url, 0);	if (ret < 0) {		fprintf(stderr, "Error in %s:%d: %s/n", __func__, __LINE__,			gnutls_strerror(ret));		exit(1);	}	ret =	    gnutls_pkcs11_privkey_export_pubkey(pkey,					        GNUTLS_X509_FMT_PEM, &pubkey,					        flags);	if (ret < 0) {		fprintf(stderr, "Error in %s:%d: %s/n", __func__, __LINE__,			gnutls_strerror(ret));		exit(1);	}	gnutls_pkcs11_privkey_deinit(pkey);	fwrite(pubkey.data, 1, pubkey.size, outfile);	gnutls_free(pubkey.data);	UNFIX;	return;}
开发者ID:attilamolnar,项目名称:gnutls,代码行数:48,


示例26: compute_multab

voidcompute_multab(){	int k, m;	short blk[64];	for (k = 1; k < 64; ++k) {		memset((char*)blk, 0, sizeof(blk));		blk[ROWZAG[k]] = FIX(1);		v_rdct(blk);		for (m = 0; m < 64; ++m) {			if (inlist(multab, nmul, blk[m]))				continue;			multab[nmul++] = blk[m];		}	}}
开发者ID:usamaaftab80,项目名称:multi-p2p,代码行数:17,


示例27: eval

static ptr eval(ptr x) {  if (Spairp(x)) {    switch (Schar_value(Scar(x))) {      case '+': return S_add(First(x), Second(x));      case '-': return S_sub(First(x), Second(x));      case '*': return S_mul(First(x), Second(x));      case '/': return S_div(First(x), Second(x));      case 'q': return S_trunc(First(x), Second(x));      case 'r': return S_rem(First(x), Second(x));      case 'g': return S_gcd(First(x), Second(x));      case '=': {        ptr x1 = First(x), x2 = Second(x);        if (Sfixnump(x1) && Sfixnump(x2))          return Sboolean(x1 == x2);        else if (Sbignump(x1) && Sbignump(x2))          return Sboolean(S_big_eq(x1, x2));        else return Sfalse;      }      case '<': {        ptr x1 = First(x), x2 = Second(x);        if (Sfixnump(x1))          if (Sfixnump(x2))            return Sboolean(x1 < x2);          else            return Sboolean(!BIGSIGN(x2));        else          if (Sfixnump(x2))            return Sboolean(BIGSIGN(x1));          else            return Sboolean(S_big_lt(x1, x2));      }      case 'f': return Sflonum(S_floatify(First(x)));      case 'c':        S_gc(get_thread_context(), UNFIX(First(x)),UNFIX(Second(x)));        return Svoid;      case 'd': return S_decode_float(Sflonum_value(First(x)));      default:        S_prin1(x);        putchar('/n');        printf("unrecognized operator, returning zero/n");        return FIX(0);    }  } else    return x;}
开发者ID:1u4nx,项目名称:ChezScheme,代码行数:45,


示例28: pkcs11_export

voidpkcs11_export(FILE * outfile, const char *url, unsigned int flags,	      common_info_st * info){	gnutls_pkcs11_obj_t obj;	gnutls_datum_t t;	int ret;	unsigned int obj_flags = flags;	pkcs11_common(info);	FIX(url, outfile, 0, info);	ret = gnutls_pkcs11_obj_init(&obj);	if (ret < 0) {		fprintf(stderr, "Error in %s:%d: %s/n", __func__, __LINE__,			gnutls_strerror(ret));		exit(1);	}	ret = gnutls_pkcs11_obj_import_url(obj, url, obj_flags);	if (ret < 0) {		fprintf(stderr, "Error in %s:%d: %s/n", __func__, __LINE__,			gnutls_strerror(ret));		exit(1);	}	ret = gnutls_pkcs11_obj_export3(obj, info->outcert_format, &t);	if (ret < 0) {        	fprintf(stderr, "Error in %s:%d: %s/n", __func__,				__LINE__, gnutls_strerror(ret));                exit(1);        }	fwrite(t.data, 1, t.size, outfile);	gnutls_free(t.data);	if (info->outcert_format == GNUTLS_X509_FMT_PEM)        	fputs("/n/n", outfile);	gnutls_pkcs11_obj_deinit(obj);	UNFIX;	return;}
开发者ID:attilamolnar,项目名称:gnutls,代码行数:45,


示例29: FIX

static const char *fix_builtin_names(const char *name){#define FIX(x) if (streq(name, x)) return "_" x	FIX("class");	FIX("final");	FIX("private");	FIX("protected");	FIX("public");	FIX("this");	/* TODO put all reserved names here */#undef FIX	return name;}
开发者ID:davidgiven,项目名称:cparser,代码行数:13,


示例30: pkcs11_set_val

staticvoid pkcs11_set_val(FILE * outfile, const char *url, int detailed,		   unsigned int flags, common_info_st * info,		   gnutls_pkcs11_obj_info_t val_type, const char *val){	int ret;	gnutls_pkcs11_obj_t obj;	pkcs11_common(info);	FIX(url, outfile, detailed, info);	CHECK_LOGIN_FLAG(flags);	ret = gnutls_pkcs11_obj_init(&obj);	if (ret < 0) {		fprintf(stderr, "Error in %s:%d: %s/n", __func__, __LINE__,			gnutls_strerror(ret));		exit(1);	}	ret = gnutls_pkcs11_obj_import_url(obj, url, flags);	if (ret < 0) {		fprintf(stderr, "Error in %s:%d: %s/n", __func__, __LINE__,			gnutls_strerror(ret));		exit(1);	}	ret =	    gnutls_pkcs11_obj_set_info(obj, val_type, val, strlen(val), flags);	if (ret < 0) {		fprintf(stderr, "Error in %s:%d: %s/n", __func__, __LINE__,			gnutls_strerror(ret));		exit(1);	}	gnutls_pkcs11_obj_deinit(obj);	return;}
开发者ID:attilamolnar,项目名称:gnutls,代码行数:38,



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


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