Add CMake project, GCC support (#540)

This is extract from #211 that enables compilation with GCC. With #211
now in the state of bitrot, I would rather try approaching it in smaller
steps that can be hopefully merged quicker, even if it does not provide
full support for all the features #211 provided.

This will _compile_ correctly with my (@janisozaur) GCC, but clang is
more picky about flexible array members and refuses to compile it yet.
I will extract remaining parts of #211 in future PRs.

I marked @fwcd as author, as he did most of the work in #211.
This commit is contained in:
Michał Janiszewski
2019-06-06 23:08:31 +02:00
committed by Matt Cooley
parent 98f1da2e9d
commit fe30c7cabc
19 changed files with 151 additions and 50 deletions

View File

@@ -0,0 +1,14 @@
target_sources(CalcManager PRIVATE
calc.cpp
CalcInput.cpp
CalcUtils.cpp
History.cpp
Number.cpp
Rational.cpp
RationalMath.cpp
scicomm.cpp
scidisp.cpp
scifunc.cpp
scioper.cpp
sciset.cpp
)

View File

@@ -1,6 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
#include <intsafe.h>
#include "Header Files/Rational.h"
using namespace std;
@@ -53,8 +52,8 @@ namespace CalcEngine
Rational::Rational(uint64_t ui)
{
uint32_t hi = HIDWORD(ui);
uint32_t lo = LODWORD(ui);
uint32_t hi = (uint32_t) (((ui) >> 32) & 0xffffffff);
uint32_t lo = (uint32_t) ui;
Rational temp = (Rational{ hi } << 32) | lo;