mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-11 08:30:55 +00:00
Upped C++ standard to C++14 and added an #if that's intended to use the built-in std::gcd when compiled on C++17 or better. Fixed for new signedness warnings resulting for taking the step to C++14.
This commit is contained in:
parent
82ca49c840
commit
2d81acb82e
@ -9,6 +9,7 @@
|
||||
#ifndef Factors_hpp
|
||||
#define Factors_hpp
|
||||
|
||||
#include <numeric>
|
||||
#include <utility>
|
||||
|
||||
namespace NumberTheory {
|
||||
@ -16,6 +17,9 @@ namespace NumberTheory {
|
||||
@returns The greatest common divisor of @c a and @c b as computed by Euclid's algorithm.
|
||||
*/
|
||||
template<class T> T greatest_common_divisor(T a, T b) {
|
||||
#if __cplusplus > 201402L
|
||||
return std::gcd(a, b);
|
||||
#else
|
||||
// TODO: replace with the C++17 GCD function, once available.
|
||||
if(a < b) {
|
||||
std::swap(a, b);
|
||||
@ -29,6 +33,7 @@ namespace NumberTheory {
|
||||
a = b;
|
||||
b = remainder;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -3037,6 +3037,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_WARN_ASSIGN_ENUM = YES;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
@ -3065,6 +3066,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_WARN_ASSIGN_ENUM = YES;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
|
@ -29,7 +29,7 @@ GLuint Shader::compile_shader(const std::string &source, GLenum type) {
|
||||
GLint logLength;
|
||||
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &logLength);
|
||||
if(logLength > 0) {
|
||||
GLchar *log = new GLchar[logLength];
|
||||
GLchar *log = new GLchar[(size_t)logLength];
|
||||
glGetShaderInfoLog(shader, logLength, &logLength, log);
|
||||
printf("Compile log:\n%s\n", log);
|
||||
delete[] log;
|
||||
@ -66,7 +66,7 @@ Shader::Shader(const std::string &vertex_shader, const std::string &fragment_sha
|
||||
GLint logLength;
|
||||
glGetProgramiv(shader_program_, GL_INFO_LOG_LENGTH, &logLength);
|
||||
if(logLength > 0) {
|
||||
GLchar *log = new GLchar[logLength];
|
||||
GLchar *log = new GLchar[(size_t)logLength];
|
||||
glGetProgramInfoLog(shader_program_, logLength, &logLength, log);
|
||||
printf("Link log:\n%s\n", log);
|
||||
delete[] log;
|
||||
|
@ -82,7 +82,7 @@ void FileHolder::ensure_file_is_at_least_length(long length) {
|
||||
long bytes_to_write = length - ftell(file_);
|
||||
if(bytes_to_write > 0)
|
||||
{
|
||||
uint8_t *empty = new uint8_t[bytes_to_write];
|
||||
uint8_t *empty = new uint8_t[(size_t)bytes_to_write];
|
||||
memset(empty, 0, (size_t)bytes_to_write);
|
||||
fwrite(empty, sizeof(uint8_t), (size_t)bytes_to_write, file_);
|
||||
delete[] empty;
|
||||
|
Loading…
x
Reference in New Issue
Block a user