📄 examples.c
字号:
/* * Architecture Lab: Part A * * High level specs for the functions that the students will rewrite * in Y86 assembly language *//* $begin examples *//* linked list element */typedef struct ELE { int val; struct ELE *next;} *list_ptr;/* sum_list - Sum the elements of a linked list */int sum_list(list_ptr ls){ int val = 0; while (ls) { val += ls->val; ls = ls->next; } return val;}/* rsum_list - Recursive version of sum_list */int rsum_list(list_ptr ls){ if (!ls) return 0; else { int val = ls->val; int rest = rsum_list(ls->next); return val + rest; }}/* copy_block - Copy src to dest and return xor checksum of src */int copy_block(int *src, int *dest, int len){ int result = 0; while (len > 0) { int val = *src++; *dest++ = val; result ^= val; len--; } return result;}/* $end examples */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -