From 3effd3abe584808c30d709ec3ff358a01510fec5 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Tue, 29 Jan 2019 13:15:45 +0100 Subject: [PATCH] Fix tutorial build and a few compilation warnings. --- doc/tutorial/13_shader_builder.cpp | 4 ++-- src/lol/math/half.h | 18 ++++++++++-------- src/math/half.cpp | 22 ++++++++++------------ 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/doc/tutorial/13_shader_builder.cpp b/doc/tutorial/13_shader_builder.cpp index 20db0968..ee9bbfaf 100644 --- a/doc/tutorial/13_shader_builder.cpp +++ b/doc/tutorial/13_shader_builder.cpp @@ -2,7 +2,7 @@ // Lol Engine — Shader builder tutorial // // Copyright © 2002—2015 Benjamin “Touky” Huet -// © 2012—2018 Sam Hocevar +// © 2012—2019 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -108,7 +108,7 @@ public: << green_pixel << blue_pixel; - builder.Build(code); + code = builder.Build(); file.Write(code); //code = file.ReadString(); diff --git a/src/lol/math/half.h b/src/lol/math/half.h index bba0919e..667fa2b0 100644 --- a/src/lol/math/half.h +++ b/src/lol/math/half.h @@ -1,11 +1,13 @@ // -// Lol Engine +// Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar -// This program is free software; you can redistribute it and/or -// modify it under the terms of the Do What The Fuck You Want To -// Public License, Version 2, as published by Sam Hocevar. See -// http://www.wtfpl.net/ for more details. +// Copyright © 2010—2019 Sam Hocevar +// +// Lol Engine is free software. It comes without any warranty, to +// the extent permitted by applicable law. You can redistribute it +// and/or modify it under the terms of the Do What the Fuck You Want +// to Public License, Version 2, as published by the WTFPL Task Force. +// See http://www.wtfpl.net/ for more details. // #pragma once @@ -81,8 +83,8 @@ public: LOL_ATTR_NODISCARD inline operator ldouble() const { return (float)(*this); } /* Array conversions */ - LOL_ATTR_NODISCARD static size_t convert(half *dst, float const *src, size_t nelem); - LOL_ATTR_NODISCARD static size_t convert(float *dst, half const *src, size_t nelem); + static void convert(half *dst, float const *src, size_t nelem); + static void convert(float *dst, half const *src, size_t nelem); /* Operations */ LOL_ATTR_NODISCARD bool operator ==(half x) const { return (float)*this == (float)x; } diff --git a/src/math/half.cpp b/src/math/half.cpp index 096519a0..ad7f95f1 100644 --- a/src/math/half.cpp +++ b/src/math/half.cpp @@ -1,11 +1,13 @@ // -// Lol Engine +// Lol Engine // -// Copyright: (c) 2010-2013 Sam Hocevar -// This program is free software; you can redistribute it and/or -// modify it under the terms of the Do What The Fuck You Want To -// Public License, Version 2, as published by Sam Hocevar. See -// http://www.wtfpl.net/ for more details. +// Copyright © 2010—2019 Sam Hocevar +// +// Lol Engine is free software. It comes without any warranty, to +// the extent permitted by applicable law. You can redistribute it +// and/or modify it under the terms of the Do What the Fuck You Want +// to Public License, Version 2, as published by the WTFPL Task Force. +// See http://www.wtfpl.net/ for more details. // #include @@ -219,7 +221,7 @@ half::operator float() const return u.f; } -size_t half::convert(half *dst, float const *src, size_t nelem) +void half::convert(half *dst, float const *src, size_t nelem) { for (size_t i = 0; i < nelem; i++) { @@ -227,11 +229,9 @@ size_t half::convert(half *dst, float const *src, size_t nelem) u.f = *src++; *dst++ = makebits(float_to_half_nobranch(u.x)); } - - return nelem; } -size_t half::convert(float *dst, half const *src, size_t nelem) +void half::convert(float *dst, half const *src, size_t nelem) { for (size_t i = 0; i < nelem; i++) { @@ -242,8 +242,6 @@ size_t half::convert(float *dst, half const *src, size_t nelem) u.x = half_to_float_nobranch((*src++).bits); *dst++ = u.f; } - - return nelem; } } /* namespace lol */