aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2021-12-24 15:21:54 -0800
committerChristian Cunningham <cc@localhost>2021-12-24 15:21:54 -0800
commit3a366988a0077474075d8f33ad76514d2fa0c5d6 (patch)
tree7aa293e59bee8308825e029069d395c628d230cd /src/lib
parentd44bf5acb015edaeacc022f423bae4743b868f53 (diff)
Standardized Formatting
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/mem.c15
-rw-r--r--src/lib/strings.c9
2 files changed, 16 insertions, 8 deletions
diff --git a/src/lib/mem.c b/src/lib/mem.c
index 3313c07..3683ae7 100644
--- a/src/lib/mem.c
+++ b/src/lib/mem.c
@@ -1,6 +1,7 @@
#include "../drivers/uart.h"
-void memshow32(unsigned long* addr, unsigned int n) {
+void memshow32(unsigned long* addr, unsigned int n)
+{
for(unsigned int i = 0; i < n; i++) {
uart_hex(addr[i]);
if (i+1 != n)
@@ -9,13 +10,15 @@ void memshow32(unsigned long* addr, unsigned int n) {
uart_char(0x0a);
}
-void memcpy(unsigned char* src, unsigned char* dest, unsigned int n) {
+void memcpy(unsigned char* src, unsigned char* dest, unsigned int n)
+{
for(unsigned int i = 0; i < n; i++) {
dest[i] = src[i];
}
}
-unsigned char memcmp(unsigned char* a, unsigned char* b, unsigned int n) {
+unsigned char memcmp(unsigned char* a, unsigned char* b, unsigned int n)
+{
for(unsigned int i = 0; i < n; i++) {
if (a[i] != b[i])
return 0;
@@ -23,13 +26,15 @@ unsigned char memcmp(unsigned char* a, unsigned char* b, unsigned int n) {
return 1;
}
-void memcpy32(unsigned long* src, unsigned long* dest, unsigned int n) {
+void memcpy32(unsigned long* src, unsigned long* dest, unsigned int n)
+{
for(unsigned int i = 0; i < n; i++) {
dest[i] = src[i];
}
}
-unsigned char memcmp32(unsigned long* a, unsigned long* b, unsigned int n) {
+unsigned char memcmp32(unsigned long* a, unsigned long* b, unsigned int n)
+{
for(unsigned int i = 0; i < n; i++) {
if (a[i] != b[i])
return 0;
diff --git a/src/lib/strings.c b/src/lib/strings.c
index 795caa2..94b315f 100644
--- a/src/lib/strings.c
+++ b/src/lib/strings.c
@@ -1,6 +1,7 @@
#include "../lib/strings.h"
-unsigned long strlen(string_t s) {
+unsigned long strlen(string_t s)
+{
unsigned long len = 0;
while (s[len] != 0) {
len += 1;
@@ -8,7 +9,8 @@ unsigned long strlen(string_t s) {
return len;
}
-unsigned char strcmp(string_t a, string_t b) {
+unsigned char strcmp(string_t a, string_t b)
+{
unsigned long idx = 0;
while (a[idx] != 0 && b[idx] != 0) {
if (a[idx] != b[idx]) {
@@ -19,7 +21,8 @@ unsigned char strcmp(string_t a, string_t b) {
return a[idx] == b[idx];
}
-unsigned char strcmpn(string_t a, string_t b, unsigned int n) {
+unsigned char strcmpn(string_t a, string_t b, unsigned int n)
+{
unsigned long idx = 0;
while (a[idx] != 0 && b[idx] != 0 && idx+1 < n) {
if (a[idx] != b[idx]) {