dev 正确提交kfifo初始代码

This commit is contained in:
zzy 2023-10-25 21:48:19 +08:00
parent 96b3289b2b
commit 25d0dac339
2 changed files with 36 additions and 0 deletions

16
test/kfifo/CMakeLists.txt Normal file
View File

@ -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 .

20
test/kfifo/kfifo.c Normal file
View File

@ -0,0 +1,20 @@
#include <stdio.h>
#include <stdlib.h>
#include <kfifo.h>
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;
}