From e3cd2ec8a834133bbaf0208a1c3d0db839066d51 Mon Sep 17 00:00:00 2001 From: HappyTanuki Date: Wed, 27 Aug 2025 15:00:03 +0900 Subject: [PATCH] initial_commit --- .vscode/c_cpp_properties.json | 16 ++++++++++++++++ .vscode/launch.json | 29 +++++++++++++++++++++++++++++ .vscode/settings.json | 11 +++++++++++ .vscode/tasks.json | 35 +++++++++++++++++++++++++++++++++++ CMakeLists.txt | 13 +++++++++++++ include/snowflake.hpp | 14 ++++++++++++++ src/main.cpp | 6 ++++++ 7 files changed, 124 insertions(+) create mode 100644 .vscode/c_cpp_properties.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 .vscode/tasks.json create mode 100644 CMakeLists.txt create mode 100644 include/snowflake.hpp create mode 100644 src/main.cpp diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..07c08df --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,16 @@ +{ + "configurations": [ + { + "name": "Linux", + "includePath": [ + "${workspaceFolder}/**" + ], + "defines": [], + "compilerPath": "/usr/bin/clang", + "cStandard": "c17", + "cppStandard": "c++17", + "intelliSenseMode": "linux-clang-x64" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..1ae5cd6 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,29 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Debug", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/build/TEST", + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + { + "description": "Set Disassembly Flavor to Intel", + "text": "-gdb-set disassembly-flavor intel", + "ignoreFailures": true + } + ], + "preLaunchTask": "${defaultBuildTask}" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..f99288d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + "files.associations": { + "chrono": "c", + "random": "c", + "limits": "c", + "semaphore": "c", + "algorithm": "c", + "ratio": "c", + "sstream": "c" + } +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..f790c8a --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,35 @@ +{ + + "version": "2.0.0", + "tasks": [ + { + "type": "cppbuild", + "label": "make", + "command": "make", + "args": [], + "options": { + "cwd": "${workspaceFolder}/build/" + }, + "group": { + "kind": "build", + "isDefault": true + }, + "dependsOn": ["cmake"] + }, + { + "type": "shell", + "label": "cmake", + "command": "cmake", + "args": [ + ".." + ], + "options": { + "cwd": "${workspaceFolder}/build/" + }, + "group": { + "kind": "build", + "isDefault": false + } + }, + ] +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..0d5654f --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required (VERSION 3.5) + +get_filename_component(PROJECT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) + +project(${PROJECT_NAME}) +aux_source_directory("src" src) +add_executable(${PROJECT_NAME} ${src}) + +set(CMAKE_BUILD_TYPE Debug) + +target_include_directories(${PROJECT_NAME} PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/include +) \ No newline at end of file diff --git a/include/snowflake.hpp b/include/snowflake.hpp new file mode 100644 index 0000000..8f6432b --- /dev/null +++ b/include/snowflake.hpp @@ -0,0 +1,14 @@ +#pragma once +#include + +union snowflake { + std::byte _value[8]; + unsigned char _cValue[8]; + struct { + unsigned int sequence : 12; + unsigned int instance : 10; + unsigned long long timestamp : 41; + unsigned int sign : 1; + }; + unsigned long long value; +}; \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..f40c299 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,6 @@ +#include + +int main(void) { + std::cout << "hi" << std::endl; + return 0; +} \ No newline at end of file