From df2326d689aade5dbda07b87528fe42d1a7fe1cc Mon Sep 17 00:00:00 2001 From: Sizhe Zhao Date: Fri, 27 Feb 2026 20:24:32 +0800 Subject: [PATCH] minimal-bootstrap.mes: vendor ldexpl.c --- .../linux/minimal-bootstrap/mes/ldexpl.c | 35 +++++++++++++++++++ .../linux/minimal-bootstrap/mes/libc.nix | 7 +--- 2 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 pkgs/os-specific/linux/minimal-bootstrap/mes/ldexpl.c diff --git a/pkgs/os-specific/linux/minimal-bootstrap/mes/ldexpl.c b/pkgs/os-specific/linux/minimal-bootstrap/mes/ldexpl.c new file mode 100644 index 000000000000..8cd5593603b1 --- /dev/null +++ b/pkgs/os-specific/linux/minimal-bootstrap/mes/ldexpl.c @@ -0,0 +1,35 @@ +/* -*-comment-start: "//";comment-end:""-*- + * GNU Mes --- Maxwell Equations of Software + * Copyright © 2025 Stefan + * + * This file is part of GNU Mes. + * + * GNU Mes is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * GNU Mes is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Mes. If not, see . + */ + +#include + +long double +ldexpl (long double arg, int exp) +{ + if (exp > 0) + do + arg *= 2; + while (--exp); + else if (exp < 0) + do + arg /= 2; + while (++exp); + return arg; +} diff --git a/pkgs/os-specific/linux/minimal-bootstrap/mes/libc.nix b/pkgs/os-specific/linux/minimal-bootstrap/mes/libc.nix index 0f9ca28912d1..9fe150ea7018 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/mes/libc.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/mes/libc.nix @@ -21,18 +21,13 @@ let sources = (import ./sources.nix).${arch}.linux.gcc; inherit (sources) libtcc1_SOURCES libc_gnu_SOURCES; - ldexpl = fetchurl { - url = "https://gitlab.com/janneke/mes/-/raw/c837abed8edb341d4e56913729fbe9803b4de47c/lib/math/ldexpl.c"; - hash = "sha256-3QoFZZIqVmlMUosEqOdYIMEHzYgQ7GJ7Hz0Bf/1iIig="; - }; - # Concatenate all source files into a convenient bundle # "gcc" variants of source files (eg. "lib/linux/x86-mes-gcc") can also be # compiled by tinycc # # Passing this many arguments is too much for kaem so we need to split # the operation in two - firstLibc = (lib.take 100 libc_gnu_SOURCES) ++ [ ldexpl ]; + firstLibc = (lib.take 100 libc_gnu_SOURCES) ++ [ ./ldexpl.c ]; lastLibc = lib.drop 100 libc_gnu_SOURCES; in kaem.runCommand "${pname}-${version}"