From 25d0dac33951cb31e4375af9c2858de544853f42 Mon Sep 17 00:00:00 2001 From: zzy <2450266535@qq.com> Date: Wed, 25 Oct 2023 21:48:19 +0800 Subject: [PATCH] =?UTF-8?q?dev=20=E6=AD=A3=E7=A1=AE=E6=8F=90=E4=BA=A4kfifo?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/kfifo/CMakeLists.txt | 16 ++++++++++++++++ test/kfifo/kfifo.c | 20 ++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 test/kfifo/CMakeLists.txt create mode 100644 test/kfifo/kfifo.c diff --git a/test/kfifo/CMakeLists.txt b/test/kfifo/CMakeLists.txt new file mode 100644 index 0000000..b54b16c --- /dev/null +++ b/test/kfifo/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.22.1) + +project(kfifo) + +set(EXECUTABLE_OUTPUT_PATH ../) +set(CMAKE_C_STANDARD 99) +set(SRC_FILE kfifo.c) + +include_directories(../../include) +add_executable(${PROJECT_NAME} ${SRC_FILE}) + +if(WIN32) + target_link_libraries(${PROJECT_NAME} wsock32 ws2_32) +endif() +# cmake .. +# cmake --build . \ No newline at end of file diff --git a/test/kfifo/kfifo.c b/test/kfifo/kfifo.c new file mode 100644 index 0000000..55d76bc --- /dev/null +++ b/test/kfifo/kfifo.c @@ -0,0 +1,20 @@ +#include +#include + +#include + +int test01(int size) { + return ((size < 2) || (size & (size - 1))) ? -1 : size; +} + +int work01() { + for (int i = 0; i < 18; i++) { + printf("%d:%d\n", i, test01(i)); + } +} + +int main() +{ + + return 0; +} \ No newline at end of file