|
| 1 | +// Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +// or more contributor license agreements. See the NOTICE file |
| 3 | +// distributed with this work for additional information |
| 4 | +// regarding copyright ownership. The ASF licenses this file |
| 5 | +// to you under the Apache License, Version 2.0 (the |
| 6 | +// "License"); you may not use this file except in compliance |
| 7 | +// with the License. You may obtain a copy of the License at |
| 8 | +// |
| 9 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +// |
| 11 | +// Unless required by applicable law or agreed to in writing, |
| 12 | +// software distributed under the License is distributed on an |
| 13 | +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +// KIND, either express or implied. See the License for the |
| 15 | +// specific language governing permissions and limitations |
| 16 | +// under the License. |
| 17 | + |
| 18 | +#pragma once |
| 19 | + |
| 20 | +// Provide minimal compatibility shims so third-party FSST sources |
| 21 | +// can be compiled with the compilers Arrow supports. |
| 22 | + |
| 23 | +#if defined(_WIN32) && !defined(_MSC_VER) |
| 24 | +#include <cpuid.h> |
| 25 | + |
| 26 | +// MinGW does not provide __cpuidex, but FSST only needs the CPUID |
| 27 | +// leaf/sub-leaf variant that __cpuid_count implements. |
| 28 | +static inline void arrow_fsst_cpuidex(int info[4], int function_id, int subfunction_id) { |
| 29 | + __cpuid_count(function_id, subfunction_id, info[0], info[1], info[2], info[3]); |
| 30 | +} |
| 31 | +#define __cpuidex(info, function_id, subfunction_id) \ |
| 32 | + arrow_fsst_cpuidex(info, function_id, subfunction_id) |
| 33 | +#endif |
0 commit comments