feat(simd): added type for specifying simd version supported

This commit is contained in:
Mineplay 2025-04-13 08:48:09 -05:00
parent c091d0dcc4
commit 76e5cff6a1
2 changed files with 61 additions and 0 deletions

View file

@ -0,0 +1,37 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* -----------------------------------------------------------------------------
* File: Simd.h
* Description:
* This file implements the functions for detecting SIMD support and defines the
* enum for specifing the SIMD type.
*
* Author: Mineplay
* -----------------------------------------------------------------------------
*/
#ifndef HALLOCY_SIMD
#define HALLOCY_SIMD
typedef enum {
HALLOCY_SIMD_UNDEFINED = 0,
HALLOCY_SIMD_NONE = 1,
HALLOCY_SIMD_SSE = 2,
HALLOCY_SIMD_SSE2 = 3,
HALLOCY_SIMD_AVX = 4,
HALLOCY_SIMD_AVX2 = 5,
HALLOCY_SIMD_AVX512 = 6,
HALLOCY_SIMD_NEON = 7
} HallocySimdType;
#endif

24
Src/Utils/Simd.c Normal file
View file

@ -0,0 +1,24 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* -----------------------------------------------------------------------------
* File: Simd.h
* Description:
* This file implements the function for detecting SIMD support.
*
* Author: Mineplay
* -----------------------------------------------------------------------------
*/
#include "../../Include/Hallocy/Utils/Simd.h"
static HallocySimdType supported_simd = HALLOCY_SIMD_UNDEFINED;