/src/S2OPC/src/Common/configuration/sopc_ieee_check.c
Line | Count | Source |
1 | | /* |
2 | | * Licensed to Systerel under one or more contributor license |
3 | | * agreements. See the NOTICE file distributed with this work |
4 | | * for additional information regarding copyright ownership. |
5 | | * Systerel licenses this file to you under the Apache |
6 | | * License, Version 2.0 (the "License"); you may not use this |
7 | | * file except in compliance with the License. You may obtain |
8 | | * a copy of the License at |
9 | | * |
10 | | * http://www.apache.org/licenses/LICENSE-2.0 |
11 | | * |
12 | | * Unless required by applicable law or agreed to in writing, |
13 | | * software distributed under the License is distributed on an |
14 | | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
15 | | * KIND, either express or implied. See the License for the |
16 | | * specific language governing permissions and limitations |
17 | | * under the License. |
18 | | */ |
19 | | |
20 | | #include <stdio.h> |
21 | | |
22 | | #include "sopc_common_constants.h" |
23 | | #include "sopc_ieee_check.h" |
24 | | |
25 | | bool SOPC_IEEE_Check(void) |
26 | 0 | { |
27 | 0 | bool bFltRadixStatus = (FLT_RADIX == 2); |
28 | 0 | bool bFltRounds = (FLT_ROUNDS == 1); |
29 | 0 | bool bStatus = (bFltRadixStatus && bFltRounds); |
30 | |
|
31 | 0 | if (false == bStatus) |
32 | 0 | { |
33 | 0 | SOPC_CONSOLE_PRINTF("ERROR: Compiler floating point support is not IEEE-754 compliant\n"); |
34 | 0 | if (false == bFltRadixStatus) |
35 | 0 | { |
36 | 0 | SOPC_CONSOLE_PRINTF("Value for FLT_RADIX is : %d instead of 2\n", FLT_RADIX); |
37 | 0 | } |
38 | 0 | if (false == bFltRounds) |
39 | 0 | { |
40 | 0 | SOPC_CONSOLE_PRINTF("Value for FLT_ROUNDS is : %d instead of 1\n", FLT_ROUNDS); |
41 | 0 | } |
42 | 0 | } |
43 | |
|
44 | 0 | return bStatus; |
45 | 0 | } |