当前位置: 首页>>代码示例>>C++>>正文


C++ LOAD函数代码示例

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


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

示例1: spear_clocksource_init

static void spear_clocksource_init(void)
{
	u32 tick_rate;
	u16 val;

	
	writew(CTRL_PRESCALER256, gpt_base + CR(CLKSRC));

	
	tick_rate = clk_get_rate(gpt_clk);
	tick_rate >>= CTRL_PRESCALER256;

	writew(0xFFFF, gpt_base + LOAD(CLKSRC));

	val = readw(gpt_base + CR(CLKSRC));
	val &= ~CTRL_ONE_SHOT;	
	val |= CTRL_ENABLE ;
	writew(val, gpt_base + CR(CLKSRC));

	
	clocksource_mmio_init(gpt_base + COUNT(CLKSRC), "tmr1", tick_rate,
		200, 16, clocksource_mmio_readw_up);
}
开发者ID:Blackburn29,项目名称:PsycoKernel,代码行数:23,代码来源:time.c

示例2: startBlock

    virtual void startBlock(
        const Block *b
    )
    {
        const uint8_t *p = b->data;
        SKIP(uint32_t, version, p);
        SKIP(uint256_t, prevBlkHash, p);
        SKIP(uint256_t, blkMerkleRoot, p);
        LOAD(uint32_t, blkTime, p);
        bTime = blkTime;

        struct tm gmTime;
        time_t blockTime = bTime;
        gmtime_r(&blockTime, &gmTime);

        char timeBuf[256];
        asctime_r(&gmTime, timeBuf);

        size_t sz =strlen(timeBuf);
        if(0<sz) timeBuf[sz-1] = 0;

	info("Processing block at time: %s", timeBuf);
    }
开发者ID:woutersmeenk,项目名称:blockparser,代码行数:23,代码来源:allTransactions.cpp

示例3: spear_clocksource_init

static void spear_clocksource_init(void)
{
	u32 tick_rate;
	u16 val;

	/* program the prescaler (/256)*/
	writew(CTRL_PRESCALER256, gpt_base + CR(CLKSRC));

	/* find out actual clock driving Timer */
	tick_rate = clk_get_rate(gpt_clk);
	tick_rate >>= CTRL_PRESCALER256;

	writew(0xFFFF, gpt_base + LOAD(CLKSRC));

	val = readw(gpt_base + CR(CLKSRC));
	val &= ~CTRL_ONE_SHOT;	/* autoreload mode */
	val |= CTRL_ENABLE ;
	writew(val, gpt_base + CR(CLKSRC));

	/* register the clocksource */
	clocksource_mmio_init(gpt_base + COUNT(CLKSRC), "tmr1", tick_rate,
		200, 16, clocksource_mmio_readw_up);
}
开发者ID:4atty,项目名称:linux,代码行数:23,代码来源:time.c

示例4: startBlock

  virtual void startBlock(
    const Block *b,
    uint64_t
    ) {
    if (lastBlock < b->height) {
      wrapup();
    }

    auto p = b->chunk->getData();
    uint8_t blockHash[kSHA256ByteSize];
    sha256Twice(blockHash, p, 80);

    SKIP(uint32_t,  version,       p);
    SKIP(uint256_t, prevBlkHash,   p);
    SKIP(uint256_t, blkMerkleRoot, p);
    LOAD(uint32_t, blkTime, p);

    blkID = b->height - 1;

    if (blkID >= firstBlock) {
      fprintf(blockFile, "%" PRIu64 "|", blkID);

      writeHexEscapedBinaryBuffer(blockFile, blockHash, kSHA256ByteSize);
      fputc('|', blockFile);
      fprintf(blockFile, "%" PRIu64 "\n", (uint64_t)blkTime);
    }

    if (0 == blkID % 5000) {
      fprintf(
        stderr,
        "block=%8" PRIu64 " "
        "nbOutputs=%9" PRIu64 "\n",
        blkID,
        outputMap.size()
        );
    }
  }
开发者ID:brishtiteveja,项目名称:bitiodine,代码行数:37,代码来源:sql.cpp

示例5: load_flat_TagFlags

static int load_flat_TagFlags(FILE *input, const char *name, TagFlags * flags)
{
    char prefix[80];
    char *next = get_line(input);
    char *data;
    int result = 0;

    *flags = 0;
    if (next != 0) {
	sprintf(prefix, "\t\t%s:", name);
	data = strtok(next, "\n ");

	if (data != 0 && !strcmp(data, prefix)) {
	    result = 1;

	    while ((data = strtok(NULL, "\n ")) != 0) {

		LOAD(endO);
		LOAD(startO);
		LOAD(mafse);
		LOAD(strict);
		LOAD(nreie);
		LOAD(frecyc);
		LOAD(nolyspcl);

		fprintf(stderr, "Unexpected TagFlag '%s'\n", data);
		result = 0;
		break;
	    }
	} else if (data) {
	    fprintf(stderr, "load_flat_TagFlags: '%s' vs '%s'\n", data, prefix);
	}
	free(next);
    }
    return result;
}
开发者ID:Distrotech,项目名称:lynx,代码行数:36,代码来源:dtd_util.c

示例6: paint3

void
paint3(Reg *r, int bn, int32 rb, int rn)
{
	Reg *r1;
	Prog *p;
	int z;
	uint32 bb;

	z = bn/32;
	bb = 1L << (bn%32);
	if(r->act.b[z] & bb)
		return;
	for(;;) {
		if(!(r->refbehind.b[z] & bb))
			break;
		r1 = (Reg*)r->f.p1;
		if(r1 == R)
			break;
		if(!(r1->refahead.b[z] & bb))
			break;
		if(r1->act.b[z] & bb)
			break;
		r = r1;
	}

	if(LOAD(r) & ~(r->set.b[z] & ~(r->use1.b[z]|r->use2.b[z])) & bb)
		addmove(r, bn, rn, 0);
	for(;;) {
		r->act.b[z] |= bb;
		p = r->f.prog;

		if(r->use1.b[z] & bb) {
			if(debug['R'] && debug['v'])
				print("%P", p);
			addreg(&p->from, rn);
			if(debug['R'] && debug['v'])
				print(" ===change== %P\n", p);
		}
		if((r->use2.b[z]|r->set.b[z]) & bb) {
			if(debug['R'] && debug['v'])
				print("%P", p);
			addreg(&p->to, rn);
			if(debug['R'] && debug['v'])
				print(" ===change== %P\n", p);
		}

		if(STORE(r) & r->regdiff.b[z] & bb)
			addmove(r, bn, rn, 1);
		r->regu |= rb;

		if(r->refbehind.b[z] & bb)
			for(r1 = (Reg*)r->f.p2; r1 != R; r1 = (Reg*)r1->f.p2link)
				if(r1->refahead.b[z] & bb)
					paint3(r1, bn, rb, rn);

		if(!(r->refahead.b[z] & bb))
			break;
		r1 = (Reg*)r->f.s2;
		if(r1 != R)
			if(r1->refbehind.b[z] & bb)
				paint3(r1, bn, rb, rn);
		r = (Reg*)r->f.s1;
		if(r == R)
			break;
		if(r->act.b[z] & bb)
			break;
		if(!(r->refbehind.b[z] & bb))
			break;
	}
}
开发者ID:TomHoenderdos,项目名称:go-sunos,代码行数:70,代码来源:reg.c

示例7: regopt


//.........这里部分代码省略.........

	/*
	 * pass 5
	 * isolate regions
	 * calculate costs (paint1)
	 */
	r = firstr;
	if(r) {
		for(z=0; z<BITS; z++)
			bit.b[z] = (r->refahead.b[z] | r->calahead.b[z]) &
			  ~(externs.b[z] | params.b[z] | addrs.b[z] | consts.b[z]);
		if(bany(&bit) && !r->f.refset) {
			// should never happen - all variables are preset
			if(debug['w'])
				print("%L: used and not set: %Q\n", r->f.prog->lineno, bit);
			r->f.refset = 1;
		}
	}
	for(r = firstr; r != R; r = (Reg*)r->f.link)
		r->act = zbits;
	rgp = region;
	nregion = 0;
	for(r = firstr; r != R; r = (Reg*)r->f.link) {
		for(z=0; z<BITS; z++)
			bit.b[z] = r->set.b[z] &
			  ~(r->refahead.b[z] | r->calahead.b[z] | addrs.b[z]);
		if(bany(&bit) && !r->f.refset) {
			if(debug['w'])
				print("%L: set and not used: %Q\n", r->f.prog->lineno, bit);
			r->f.refset = 1;
			excise(&r->f);
		}
		for(z=0; z<BITS; z++)
			bit.b[z] = LOAD(r) & ~(r->act.b[z] | addrs.b[z]);
		while(bany(&bit)) {
			i = bnum(bit);
			rgp->enter = r;
			rgp->varno = i;
			change = 0;
			paint1(r, i);
			bit.b[i/32] &= ~(1L<<(i%32));
			if(change <= 0)
				continue;
			rgp->cost = change;
			nregion++;
			if(nregion >= NRGN) {
				if(debug['R'] && debug['v'])
					print("too many regions\n");
				goto brk;
			}
			rgp++;
		}
	}
brk:
	qsort(region, nregion, sizeof(region[0]), rcmp);

	if(debug['R'] && debug['v'])
		dumpit("pass5", &firstr->f, 1);

	/*
	 * pass 6
	 * determine used registers (paint2)
	 * replace code (paint3)
	 */
	rgp = region;
	for(i=0; i<nregion; i++) {
开发者ID:TomHoenderdos,项目名称:go-sunos,代码行数:67,代码来源:reg.c

示例8: OPEN

HRESULT OPEN(PCTSTR ptzDir, PCTSTR ptzFile, BOOL bSubDir = FALSE)
{
	HRESULT hResult = ERROR_FILE_NOT_FOUND;

	// Lookup
	WIN32_FIND_DATA fd;
	TCHAR tzPath[MAX_PATH];
	UStrPrint(tzPath, TEXT("%s\\%s"), ptzDir, ptzFile);
	HANDLE hFind = FindFirstFile(tzPath, &fd);
	if (hFind != INVALID_HANDLE_VALUE)
	{
		do
		{
			if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
			{
				UStrPrint(tzPath, TEXT("%s\\%s"), ptzDir, fd.cFileName);

				// Take action
				PTSTR ptzExt = UStrRChr(fd.cFileName, '.');
				if (ptzExt)
				{
					if ((UStrCmpI(ptzExt, TEXT(".csc")) == 0) || (UStrCmpI(ptzExt, TEXT(".reg")) == 0))
					{
						hResult = LOAD(tzPath);
					}
					else if ((UStrCmpI(ptzExt, TEXT(".dll")) == 0) || (UStrCmpI(ptzExt, TEXT(".ocx")) == 0) || (UStrCmpI(ptzExt, TEXT(".ax")) == 0))
					{
						hResult = CDLL(tzPath);
					}
					else if (UStrCmpI(ptzExt, TEXT(".inf")) == 0)
					{
						TCHAR tzCmd[MAX_PATH];
						UStrPrint(tzCmd, TEXT("DefaultInstall 132 %s"), tzPath);
						InstallHinfSection(NULL, NULL, tzCmd, 0);
						hResult = S_OK;
					}
					else
					{
						// Pass to shell to execute it
						hResult = !ShellOpen(tzPath, NULL, (fd.cFileName[0] == '!') ? SW_HIDE : SW_NORMAL);
					}
				}		
			}
		}
		while (FindNextFile(hFind, &fd));
		FindClose(hFind);
	}

	if (bSubDir)
	{
		UStrPrint(tzPath, TEXT("%s\\*"), ptzDir);
		hFind = FindFirstFile(tzPath, &fd);
		if (hFind != INVALID_HANDLE_VALUE)
		{
			do
			{
				if ((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && (fd.cFileName[0] != '.'))
				{
					UStrPrint(tzPath, TEXT("%s\\%s"), ptzDir, fd.cFileName);
					if (hResult == ERROR_FILE_NOT_FOUND)
					{
						hResult = OPEN(tzPath, ptzFile, bSubDir);
					}
					else
					{
						OPEN(tzPath, ptzFile, bSubDir);
					}
				}
			}
			while (FindNextFile(hFind, &fd));
			FindClose(hFind);
		}
	}
	return hResult;
}
开发者ID:Yonsm,项目名称:CeleScript,代码行数:75,代码来源:CeleScript.cpp

示例9: paint1

void
paint1(Reg *r, int bn)
{
	Reg *r1;
	Prog *p;
	int z;
	uint32_t bb;

	z = bn/32;
	bb = 1L<<(bn%32);
	if(r->act.b[z] & bb)
		return;
	for(;;) {
		if(!(r->refbehind.b[z] & bb))
			break;
		r1 = r->p1;
		if(r1 == R)
			break;
		if(!(r1->refahead.b[z] & bb))
			break;
		if(r1->act.b[z] & bb)
			break;
		r = r1;
	}

	if(LOAD(r) & ~(r->set.b[z]&~(r->use1.b[z]|r->use2.b[z])) & bb) {
		change -= CLOAD * r->loop;
		if(debug['R'] && debug['v'])
			print("%ld%P\tld %B $%d\n", r->loop,
				r->prog, blsh(bn), change);
	}
	for(;;) {
		r->act.b[z] |= bb;
		p = r->prog;

		if(r->use1.b[z] & bb) {
			change += CREF * r->loop;
			if(p->as == AFMOVL || p->as == AFMOVW)
				if(BtoR(bb) != D_F0)
					change = -CINF;
			if(debug['R'] && debug['v'])
				print("%ld%P\tu1 %B $%d\n", r->loop,
					p, blsh(bn), change);
		}

		if((r->use2.b[z]|r->set.b[z]) & bb) {
			change += CREF * r->loop;
			if(p->as == AFMOVL || p->as == AFMOVW)
				if(BtoR(bb) != D_F0)
					change = -CINF;
			if(debug['R'] && debug['v'])
				print("%ld%P\tu2 %B $%d\n", r->loop,
					p, blsh(bn), change);
		}

		if(STORE(r) & r->regdiff.b[z] & bb) {
			change -= CLOAD * r->loop;
			if(p->as == AFMOVL || p->as == AFMOVW)
				if(BtoR(bb) != D_F0)
					change = -CINF;
			if(debug['R'] && debug['v'])
				print("%ld%P\tst %B $%d\n", r->loop,
					p, blsh(bn), change);
		}

		if(r->refbehind.b[z] & bb)
			for(r1 = r->p2; r1 != R; r1 = r1->p2link)
				if(r1->refahead.b[z] & bb)
					paint1(r1, bn);

		if(!(r->refahead.b[z] & bb))
			break;
		r1 = r->s2;
		if(r1 != R)
			if(r1->refbehind.b[z] & bb)
				paint1(r1, bn);
		r = r->s1;
		if(r == R)
			break;
		if(r->act.b[z] & bb)
			break;
		if(!(r->refbehind.b[z] & bb))
			break;
	}
}
开发者ID:carriercomm,项目名称:legacy,代码行数:85,代码来源:reg.c

示例10: pulse_init

/*static*/ int
pulse_init(cubeb ** context, char const * context_name)
{
  void * libpulse = NULL;
  cubeb * ctx;

  *context = NULL;

#ifndef DISABLE_LIBPULSE_DLOPEN
  libpulse = dlopen("libpulse.so.0", RTLD_LAZY);
  if (!libpulse) {
    return CUBEB_ERROR;
  }

#define LOAD(x) do { \
    cubeb_##x = dlsym(libpulse, #x); \
    if (!cubeb_##x) { \
      dlclose(libpulse); \
      return CUBEB_ERROR; \
    } \
  } while(0)
  LOAD(pa_channel_map_init_auto);
  LOAD(pa_context_connect);
  LOAD(pa_context_disconnect);
  LOAD(pa_context_drain);
  LOAD(pa_context_get_state);
  LOAD(pa_context_new);
  LOAD(pa_context_rttime_new);
  LOAD(pa_context_set_state_callback);
  LOAD(pa_context_get_sink_info_by_name);
  LOAD(pa_context_get_server_info);
  LOAD(pa_context_unref);
  LOAD(pa_frame_size);
  LOAD(pa_operation_get_state);
  LOAD(pa_operation_unref);
  LOAD(pa_rtclock_now);
  LOAD(pa_stream_begin_write);
  LOAD(pa_stream_cancel_write);
  LOAD(pa_stream_connect_playback);
  LOAD(pa_stream_cork);
  LOAD(pa_stream_disconnect);
  LOAD(pa_stream_get_latency);
  LOAD(pa_stream_get_state);
  LOAD(pa_stream_get_time);
  LOAD(pa_stream_new);
  LOAD(pa_stream_set_state_callback);
  LOAD(pa_stream_set_write_callback);
  LOAD(pa_stream_unref);
  LOAD(pa_stream_update_timing_info);
  LOAD(pa_stream_write);
  LOAD(pa_threaded_mainloop_free);
  LOAD(pa_threaded_mainloop_get_api);
  LOAD(pa_threaded_mainloop_lock);
  LOAD(pa_threaded_mainloop_in_thread);
  LOAD(pa_threaded_mainloop_new);
  LOAD(pa_threaded_mainloop_signal);
  LOAD(pa_threaded_mainloop_start);
  LOAD(pa_threaded_mainloop_stop);
  LOAD(pa_threaded_mainloop_unlock);
  LOAD(pa_threaded_mainloop_wait);
  LOAD(pa_usec_to_bytes);
#undef LOAD
#endif

  ctx = calloc(1, sizeof(*ctx));
  assert(ctx);

  ctx->ops = &pulse_ops;
  ctx->libpulse = libpulse;

  ctx->mainloop = WRAP(pa_threaded_mainloop_new)();
  ctx->context = WRAP(pa_context_new)(WRAP(pa_threaded_mainloop_get_api)(ctx->mainloop), context_name);

  WRAP(pa_context_set_state_callback)(ctx->context, context_state_callback, ctx);
  WRAP(pa_threaded_mainloop_start)(ctx->mainloop);

  WRAP(pa_threaded_mainloop_lock)(ctx->mainloop);
  WRAP(pa_context_connect)(ctx->context, NULL, 0, NULL);

  if (wait_until_context_ready(ctx) != 0) {
    WRAP(pa_threaded_mainloop_unlock)(ctx->mainloop);
    pulse_destroy(ctx);
    return CUBEB_ERROR;
  }
  WRAP(pa_context_get_server_info)(ctx->context, server_info_callback, ctx);
  WRAP(pa_threaded_mainloop_unlock)(ctx->mainloop);

  *context = ctx;

  return CUBEB_OK;
}
开发者ID:at13,项目名称:mozilla-central,代码行数:91,代码来源:cubeb_pulse.c

示例11: main

int main(int argc, char** argv) {
    if (argc != 2) {
        fprintf(stderr, "ERROR: ENTER ONLY ONE ARGUMENT...\n");
        exit(1);
    }
    char v_char;
    signed char v_byte;
    unsigned char v_ubyte;
    short int v_short;
    int v_int;
    long int v_long;
    unsigned short int v_ushort;
    unsigned int v_uint;
    unsigned long int v_ulong;
    float v_float;
    double v_double;
    std::string v_str;
    
    Point point_obj;
    Line line_obj;
    std::vector<Point> array_obj;
    std::vector<double> tensor_obj;
    
    xc::STextInterface<xc::load_mode> text_obj(argv[1], strlen(argv[1]));
    #define LOAD(v) text_obj.load(v)
    LOAD(v_char);
    LOAD(v_byte);
    LOAD(v_ubyte);
    LOAD(v_short);
    LOAD(v_int);
    LOAD(v_long);
    LOAD(v_ushort);
    LOAD(v_uint);
    LOAD(v_ulong);
    LOAD(v_float);
    LOAD(v_double);
    LOAD(v_str);
    LOAD(point_obj);
    LOAD(line_obj);
    text_obj.load(array_obj, array_obj[0]);
    text_obj.load(tensor_obj, tensor_obj[0]);
    text_obj.close();
    
    #define PRINT(v) std::cout << #v << ": " << v << "\n";
    PRINT(v_char);
    PRINT((int)v_byte);
    PRINT((int)v_ubyte);
    PRINT(v_short);
    PRINT(v_int);
    PRINT(v_long);
    PRINT(v_ushort);
    PRINT(v_uint);
    PRINT(v_ulong);
    PRINT(v_float);
    PRINT(v_double);
    PRINT(v_str);
    printf("point_obj: Point(%f, %f)\n", point_obj.x, point_obj.y);
    printf("line_obj: [Point(%f, %f), Point(%f, %f)]\n", 
            line_obj.a.x, line_obj.a.y, line_obj.b.x, line_obj.b.y);
    printf("array_obj: \n");
    for (int i=0; i < array_obj.size(); ++i) {
        printf("  Point(%f, %f)\n", array_obj[i].x, array_obj[i].y);
    }
    printf("tensor_obj: \n");
    for (int i=0; i < tensor_obj.size(); ++i) {
        printf("  %f\n", tensor_obj[i]);
    }
}
开发者ID:jmlopez-rod,项目名称:excentury,代码行数:68,代码来源:load_text_str.cpp

示例12: shaCompress

/*
 *  SHA: Compression function, unrolled.
 *
 * Some operations in shaCompress are done as 5 groups of 16 operations.
 * Others are done as 4 groups of 20 operations.
 * The code below shows that structure.
 *
 * The functions that compute the new values of the 5 state variables
 * A-E are done in 4 groups of 20 operations (or you may also think
 * of them as being done in 16 groups of 5 operations).  They are
 * done by the SHA_RNDx macros below, in the right column.
 *
 * The functions that set the 16 values of the W array are done in
 * 5 groups of 16 operations.  The first group is done by the
 * LOAD macros below, the latter 4 groups are done by SHA_MIX below,
 * in the left column.
 *
 * gcc's optimizer observes that each member of the W array is assigned
 * a value 5 times in this code.  It reduces the number of store
 * operations done to the W array in the context (that is, in the X array)
 * by creating a W array on the stack, and storing the W values there for
 * the first 4 groups of operations on W, and storing the values in the
 * context's W array only in the fifth group.  This is undesirable.
 * It is MUCH bigger code than simply using the context's W array, because
 * all the offsets to the W array in the stack are 32-bit signed offsets,
 * and it is no faster than storing the values in the context's W array.
 *
 * The original code for sha_fast.c prevented this creation of a separate
 * W array in the stack by creating a W array of 80 members, each of
 * whose elements is assigned only once. It also separated the computations
 * of the W array values and the computations of the values for the 5
 * state variables into two separate passes, W's, then A-E's so that the
 * second pass could be done all in registers (except for accessing the W
 * array) on machines with fewer registers.  The method is suboptimal
 * for machines with enough registers to do it all in one pass, and it
 * necessitates using many instructions with 32-bit offsets.
 *
 * This code eliminates the separate W array on the stack by a completely
 * different means: by declaring the X array volatile.  This prevents
 * the optimizer from trying to reduce the use of the X array by the
 * creation of a MORE expensive W array on the stack. The result is
 * that all instructions use signed 8-bit offsets and not 32-bit offsets.
 *
 * The combination of this code and the -O3 optimizer flag on GCC 3.4.3
 * results in code that is 3 times faster than the previous NSS sha_fast
 * code on AMD64.
 */
static void NO_SANITIZE_ALIGNMENT
shaCompress(volatile SHA_HW_t *X, const PRUint32 *inbuf)
{
    register SHA_HW_t A, B, C, D, E;

#if defined(SHA_NEED_TMP_VARIABLE)
    register PRUint32 tmp;
#endif

#if !defined(SHA_PUT_W_IN_STACK)
#define XH(n) X[n - H2X]
#define XW(n) X[n - W2X]
#else
    SHA_HW_t w_0, w_1, w_2, w_3, w_4, w_5, w_6, w_7,
        w_8, w_9, w_10, w_11, w_12, w_13, w_14, w_15;
#define XW(n) w_##n
#define XH(n) X[n]
#endif

#define K0 0x5a827999L
#define K1 0x6ed9eba1L
#define K2 0x8f1bbcdcL
#define K3 0xca62c1d6L

#define SHA_RND1(a, b, c, d, e, n)                         \
    a = SHA_ROTL(b, 5) + SHA_F1(c, d, e) + a + XW(n) + K0; \
    c = SHA_ROTL(c, 30)
#define SHA_RND2(a, b, c, d, e, n)                         \
    a = SHA_ROTL(b, 5) + SHA_F2(c, d, e) + a + XW(n) + K1; \
    c = SHA_ROTL(c, 30)
#define SHA_RND3(a, b, c, d, e, n)                         \
    a = SHA_ROTL(b, 5) + SHA_F3(c, d, e) + a + XW(n) + K2; \
    c = SHA_ROTL(c, 30)
#define SHA_RND4(a, b, c, d, e, n)                         \
    a = SHA_ROTL(b, 5) + SHA_F4(c, d, e) + a + XW(n) + K3; \
    c = SHA_ROTL(c, 30)

#define LOAD(n) XW(n) = SHA_HTONL(inbuf[n])

    A = XH(0);
    B = XH(1);
    C = XH(2);
    D = XH(3);
    E = XH(4);

    LOAD(0);
    SHA_RND1(E, A, B, C, D, 0);
    LOAD(1);
    SHA_RND1(D, E, A, B, C, 1);
    LOAD(2);
    SHA_RND1(C, D, E, A, B, 2);
    LOAD(3);
    SHA_RND1(B, C, D, E, A, 3);
//.........这里部分代码省略.........
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:101,代码来源:sha_fast.c

示例13: RC2_InitContext

SECStatus   
RC2_InitContext(RC2Context *cx, const unsigned char *key, unsigned int len,
	        const unsigned char *input, int mode, unsigned int efLen8, 
		unsigned int unused)
{
    PRUint8    *L,*L2;
    int         i;
#if !defined(IS_LITTLE_ENDIAN)
    PRUint16    tmpS;
#endif
    PRUint8     tmpB;

    if (!key || !cx || !len || len > (sizeof cx->B) || 
	efLen8 > (sizeof cx->B)) {
	PORT_SetError(SEC_ERROR_INVALID_ARGS);
    	return SECFailure;
    }
    if (mode == NSS_RC2) {
    	/* groovy */
    } else if (mode == NSS_RC2_CBC) {
    	if (!input) {
	    PORT_SetError(SEC_ERROR_INVALID_ARGS);
	    return SECFailure;
	}
    } else {
	PORT_SetError(SEC_ERROR_INVALID_ARGS);
	return SECFailure;
    }

    if (mode == NSS_RC2_CBC) {
    	cx->enc = & rc2_EncryptCBC;
	cx->dec = & rc2_DecryptCBC;
	LOAD(cx->iv.s);
    } else {
    	cx->enc = & rc2_EncryptECB;
	cx->dec = & rc2_DecryptECB;
    }

    /* Step 0. Copy key into table. */
    memcpy(cx->B, key, len);

    /* Step 1. Compute all values to the right of the key. */
    L2 = cx->B;
    L = L2 + len;
    tmpB = L[-1];
    for (i = (sizeof cx->B) - len; i > 0; --i) {
	*L++ = tmpB = S[ (PRUint8)(tmpB + *L2++) ];
    }

    /* step 2. Adjust left most byte of effective key. */
    i = (sizeof cx->B) - efLen8;
    L = cx->B + i;
    *L = tmpB = S[*L];				/* mask is always 0xff */

    /* step 3. Recompute all values to the left of effective key. */
    L2 = --L + efLen8;
    while(L >= cx->B) {
	*L-- = tmpB = S[ tmpB ^ *L2-- ];
    }

#if !defined(IS_LITTLE_ENDIAN)
    for (i = 63; i >= 0; --i) {
        SWAPK(i);		/* candidate for unrolling */
    }
#endif
    return SECSuccess;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:67,代码来源:alg2268.c

示例14: LOAD

void rust_gpr::load() {
    LOAD(rax); LOAD(rbx); LOAD(rcx); LOAD(rdx);
    LOAD(rsi); LOAD(rdi); LOAD(rbp); LOAD(rsi);
    LOAD(r8);  LOAD(r9);  LOAD(r10); LOAD(r11);
    LOAD(r12); LOAD(r13); LOAD(r14); LOAD(r15);
}
开发者ID:BrandonBarrett,项目名称:rust,代码行数:6,代码来源:gpr.cpp

示例15: WAIT

enum {
	TITLE_SCRIPT_WAIT,
	TITLE_SCRIPT_LOAD,
	TITLE_SCRIPT_LOCATION,
	TITLE_SCRIPT_ROTATE,
	TITLE_SCRIPT_RESTART,
};

#define WAIT(t)				TITLE_SCRIPT_WAIT, t
#define LOAD()				TITLE_SCRIPT_LOAD
#define LOCATION(x, y)		TITLE_SCRIPT_LOCATION, x, y
#define ROTATE(n)			TITLE_SCRIPT_ROTATE, n
#define RESTART()			TITLE_SCRIPT_RESTART

static const uint8 _magicMountainScript[] = {
	LOAD(),
	LOCATION(210, 112), WAIT(13),
	ROTATE(1), LOCATION(210, 112), WAIT(14),
	ROTATE(3), LOCATION(167, 180), WAIT(12),
	ROTATE(1), LOCATION(155, 189), WAIT(12),
	LOCATION(106, 39), WAIT(12),
	LOCATION(182, 50), WAIT(12),
	ROTATE(3), LOCATION(209, 47), WAIT(12),
	ROTATE(1), LOCATION(159, 93), WAIT(12),
	RESTART(),
};

static const uint8* _currentScript;
static int _scriptWaitCounter;

static void title_init_showcase();
开发者ID:benpye,项目名称:OpenRCT2,代码行数:31,代码来源:title.c


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