From defbfcb6d857b7ccd9a0d2ffc15bd559ad2148f2 Mon Sep 17 00:00:00 2001 From: AlanRen Date: Sun, 18 Sep 2022 03:45:32 +0800 Subject: [PATCH] add --- .gitignore | 6 ++++++ test/main.cpp | 22 +++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1200285 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ + +.vscode/ + +build/ + +release/ diff --git a/test/main.cpp b/test/main.cpp index 4a7d6dc..9acf94e 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -1,11 +1,31 @@ #include #include #include "common.h" +typedef uint64_t u64 ; +static u64 be64_to_cpu(u64 x) +{ + u64 r; + int i, len; + char *p, *q; + len = sizeof(x); + q = (char *)&x + len - 1; + p = (char *)&r; + for (i = 0; i < len; i++) + { + *p = *q; + p++; + q--; + } + + return r; +} int main(){ - + u64 rt,data=0xFFF; + rt=be64_to_cpu(data); + return 0; }