示例#1
0
文件: testrand.c 项目: GDXN/test
int main(int N, char ** S)
{
	unsigned char	gseed[SEED_TOTAL], * ptr ;
	unsigned char	gdata[TEST_BLOCK] ;
	int istep, ival ;

	if ( read_devrand(gseed, SEED_RAND)) { exit( 1) ; }

	ptr= gseed + SEED_RAND ;
	ival= getpid() ;  if ( ival ) { PACK2(ptr, ival) ; }
	ival= getuid() ;  if ( ival ) { PACK2(ptr, ival) ; }

#ifdef	_POSIX_TIMERS
	{
		struct timespec tspec ;
		if ( ! clock_gettime(CLOCK_REALTIME, &tspec )) { ival= tspec.tv_nsec ;  PACK4(ptr, ival) ; }
	}
#endif

	RAND_seed(gseed, ( ptr - gseed )) ;
	if (! RAND_status())
		{ fprintf(stderr, "RAND not initialized\n") ;  exit( 1) ; }

	if ( ! RAND_bytes(gdata, TEST_BLOCK) )
		{ fprintf(stderr, "RAND bytes failed\n") ;  exit( 1) ; }

	for ( istep= TEST_BLOCK, ptr= gdata ; ( istep -- ) ; ptr ++ )
		{ printf("%02x", * ptr ) ; }
	printf("\n\n") ;

	return 0 ;
}
示例#2
0
文件: pltiffdec.cpp 项目: artcom/y60
/*
 * 8-bit packed samples => RGBA w/ associated alpha
 * (known to have Map == NULL)
 */
static void putRGBAAcontig8bittile(
    TIFFRGBAImage* img,
    uint32* cp,
    uint32 x, uint32 y,
    uint32 w, uint32 h,
    int32 fromskew, int32 toskew,
    u_char* pp
)
{
    int samplesperpixel = img->samplesperpixel;

    (void) x; (void) y;
    fromskew *= samplesperpixel;
    while (h-- > 0) {
      UNROLL8(w, NOP,
              *cp++ = PACK4(pp[0], pp[1], pp[2], pp[3]);
              pp += samplesperpixel);
  cp += toskew;
  pp += fromskew;
    }
}