資源簡介
自己寫的csapp上的性能優(yōu)化實(shí)驗(yàn)的kernels.c。
代碼片段和文件信息
/********************************************************
?*?Kernels?to?be?optimized?for?the?CS:APP?Performance?Lab
?********************************************************/
#include?
#include?
#include?“defs.h“
/*?
?*?Please?fill?in?the?following?team?struct?
?*/
team_t?team?=?{
????“5120379091“??????????????/*?Student?ID?*/
????“Gao?Ce“???????????/*?Your?Name?*/
????“gaoce270863799@se.sjtu.edu.cn“??/*?First?member?email?address?*/
????““???????????????????/*?Second?member?full?name?(leave?blank?if?none)?*/
????““????????????????????/*?Second?member?email?addr?(leave?blank?if?none)?*/
};
/***************
?*?ROTATE?KERNEL
?***************/
/******************************************************
?*?Your?different?versions?of?the?rotate?kernel?go?here
?******************************************************/
/*
?*Add?the?description?of?your?Rotate?implementation?here!!!
?*1.?Brief?Intro?of?method
?*2.?CPE?Achieved
?*3.?other?words
?*/
/*?
?*?naive_rotate?-?The?naive?baseline?version?of?rotate?
?*/
char?naive_rotate_descr[]?=?“naive_rotate:?Naive?baseline?implementation“;
void?naive_rotate(int?dim?pixel?*src?pixel?*dst)?
{
????int?i?j;
????for?(i?=?0;?i?????for?(j?=?0;?j?????????dst[RIDX(dim-1-j?i?dim)]?=?src[RIDX(i?j?dim)];
}
/*?
?*?rotate?-?Your?current?working?version?of?rotate
?*?IMPORTANT:?This?is?the?version?you?will?be?graded?on
?*/
char?rotate_descr[]?=?“rotate:?Current?working?version“;
void?rotate(int?dim?pixel?*src?pixel?*dst)
{
????int?i?j;
????dst?+=?(dim-1)*dim;
????for?(i?=?0;?i?????????????for?(j?=?0;?j?????????????????*dst=*src;
????????????????src+=dim;
????????????????dst+=1;
????????????????*dst=*src;
????????????????src+=dim;
????????????????dst+=1;
????????????????*dst=*src;
????????????????src+=dim;
????????????????dst+=1;
????????????????*dst=*src;
????????????????src+=dim;
????????????????dst+=1;
????????????????*dst=*src;
????????????????src+=dim;
????????????????dst+=1;
????????????????*dst=*src;
????????????????src+=dim;
????????????????dst+=1;
????????????????*dst=*src;
????????????????src+=dim;
????????????????dst+=1;
????????????????*dst=*src;
????????????????src+=dim;
????????????????dst+=1;
????????????????*dst=*src;
????????????????src+=dim;
????????????????dst+=1;
????????????????*dst=*src;
????????????????src+=dim;
????????????????dst+=1;
????????????????*dst=*src;
????????????????src+=dim;
????????????????dst+=1;
????????????????*dst=*src;
????????????????src+=dim;
????????????????dst+=1;
????????????????*dst=*src;
????????????????src+=dim;
????????????????dst+=1;
????????????????*dst=*src;
????????????????src+=dim;
????????????????dst+=1;
????????????????*dst=*src;
????????????????src+=dim;
????????????????dst+=1;
????????????????*dst=*src;
????????????????src+=dim;
????????????????dst+=1;
????????????????*dst=*src;
????????????????src+=dim;
????????????????dst+=1;
????????????????*dst=*src;
?????????
評論
共有 條評論