• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ FIX函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: gen_basis

void
gen_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,代码来源:mkbv.c


示例2: pkcs11_mechanism_list

void
pkcs11_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,代码来源:pkcs11.c


示例3: adsr

// shouldn't need to check alive bit - never called for dead voices (no zombie channels possible)
// FIXME: bloat
int 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,代码来源:general.c


示例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,代码来源:stats.c


示例5: pkcs11_get_random

void
pkcs11_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,代码来源:pkcs11.c


示例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,代码来源:getgr_r.c


示例7: libnet_insert_ipo

int
libnet_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,代码来源:libnet_insert_ipo.c


示例8: start_pass_merged_upsample

METHODDEF void
start_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,代码来源:jdmerge.c


示例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,代码来源:getrlimit.c


示例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 void
TIFFYCbCrToRGBInit(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,代码来源:tif_getimage.c


示例11: pkcs11_generate

void
pkcs11_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,代码来源:pkcs11.c


示例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,代码来源:alloc.c


示例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,代码来源:mythpainter_yuva.cpp


示例14: libnet_write_ip

int
libnet_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,代码来源:libnet_write_ip.c


示例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,代码来源:main.c


示例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,代码来源:yuvp.c


示例17: InitColorDither

void
InitColorDither()
{
    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,代码来源:24bit.c


示例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,代码来源:getpw_r.c


示例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,代码来源:AtmoFilter.cpp


示例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,代码来源:lookahead.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FIX2FLT函数代码示例发布时间:2022-05-30
下一篇:
C++ FIRST_THREAD_IN_PROC函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap