Skip to content

Instantly share code, notes, and snippets.

View dascandy's full-sized avatar

Peter Bindels dascandy

View GitHub Profile
#include <stdio.h>
const char* GetCompilerVersion() {
return "GCC/Clang (working)";
}
template <typename T>
class X {
public:
static const char* GetCompilerVersion() {

Keybase proof

I hereby claim:

  • I am dascandy on github.
  • I am dascandy (https://keybase.io/dascandy) on keybase.
  • I have a public key ASBQG5TuMnIgboZECsyAmCEj4kKdK0DXQezpt_cNXFQ1yQo

To claim this, I am signing this object:

@dascandy
dascandy / gist:544acdfdc907051bcaa0b51d6d4a334a
Created January 6, 2020 09:54
Simple C/C++ port scanner.
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netdb.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
int main(int argc, char** argv) {
@dascandy
dascandy / gist:20a0c890dc565f6fadffda0bd268f5b5
Created May 29, 2020 07:40
Freestanding experimental/coroutine
#pragma once
namespace std {
template <typename T> struct remove_cv { using type = T; };
template <typename T> struct remove_cv<const T> { using type = T; };
template <typename T> struct remove_cv<volatile T> { using type = T; };
template <typename T> struct remove_cv<const volatile T> { using type = T; };
template <typename T> using remove_cv_t = typename remove_cv<T>::type;
#pragma once
#include <type_traits>
namespace std::experimental {
template<typename R, typename... ArgTypes>
struct coroutine_traits {
using promise_type = typename R::promise_type;
};
diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt
index d5852bbff..bb433d872 100644
--- a/Kernel/CMakeLists.txt
+++ b/Kernel/CMakeLists.txt
@@ -362,13 +362,13 @@ macro (set_new_alignment alignment)
endmacro()
if ("${SERENITY_ARCH}" STREQUAL "x86_64")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcmodel=large -fno-pic -mno-red-zone")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-pic -mno-red-zone")
diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt
index d5852bbff..4e980d1fd 100644
--- a/Kernel/CMakeLists.txt
+++ b/Kernel/CMakeLists.txt
@@ -362,10 +362,9 @@ macro (set_new_alignment alignment)
endmacro()
if ("${SERENITY_ARCH}" STREQUAL "x86_64")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcmodel=large -fno-pic -mno-red-zone")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-pic -mno-red-zone")
diff --git a/Userland/Services/WindowServer/Compositor.cpp b/Userland/Services/WindowServer/Compositor.cpp
index 017c9d48d..4503ae756 100644
--- a/Userland/Services/WindowServer/Compositor.cpp
+++ b/Userland/Services/WindowServer/Compositor.cpp
@@ -322,32 +322,33 @@ void Compositor::compose()
{
// Paint any desktop wallpaper rects that are not somehow underneath any window transparency
// rects and outside of any opaque window areas
- auto paint_desktop_wallpaper = [&]<bool is_opaque>(const Gfx::IntRect& render_rect) {
+ m_opaque_wallpaper_rects.for_each_intersected(dirty_screen_rects, [&](auto& render_rect) {
#pragma once
#include <cstdint>
#include <vector>
inline constexpr const static uint8_t sbox_forward[] = {
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
@dascandy
dascandy / gist:ac4b6a0e86c5edc10d7395f689687fb0
Created November 21, 2022 10:37
float roundtrip conversion test
#include <atomic>
#include <vector>
#include <thread>
#include <string>
#include <cstdio>
#include <charconv>
bool test(float f) {
#if 0
float f2 = std::stof(std::to_string(f));