dev 正确提交kfifo初始代码
This commit is contained in:
parent
96b3289b2b
commit
25d0dac339
16
test/kfifo/CMakeLists.txt
Normal file
16
test/kfifo/CMakeLists.txt
Normal 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
20
test/kfifo/kfifo.c
Normal 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;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user