parent
24bece0978
commit
25fc46e397
@ -1,71 +0,0 @@
|
||||
From 64a98f1bdc2a37c4dd1f29ee6886ed5f4688439e Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Reiter Horn <danielrh@users.sourceforge.net>
|
||||
Date: Wed, 2 Oct 2024 00:43:00 -0700
|
||||
Subject: [PATCH] Fix 32 bit tests by allocating less memory by running with
|
||||
less parallelism in that case
|
||||
|
||||
---
|
||||
src/enc/test.rs | 33 ++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 32 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/enc/test.rs b/src/enc/test.rs
|
||||
index 744472b..854d9b8 100755
|
||||
--- a/src/enc/test.rs
|
||||
+++ b/src/enc/test.rs
|
||||
@@ -211,6 +211,34 @@ fn oneshot_compress(
|
||||
|
||||
(true, next_out_offset)
|
||||
}
|
||||
+static lock32: core::sync::atomic::AtomicU32 = core::sync::atomic::AtomicU32::new(0);
|
||||
+
|
||||
+/// 32bit systems do not have sufficient memory to compress multiple items
|
||||
+/// at the same time with the current limits and defaults. So we instead spin
|
||||
+/// until a process has completed compression. We cannot use proper locks
|
||||
+/// in nostd, so we fall back to this simple spin lock.
|
||||
+#[cfg(target_pointer_width = "32")]
|
||||
+fn lock_if_32bit(){
|
||||
+ use core::sync::atomic::Ordering;
|
||||
+ loop {
|
||||
+ let cur = lock32.fetch_add(1, Ordering::SeqCst);
|
||||
+ if cur == 0 {
|
||||
+ return;
|
||||
+ }
|
||||
+ lock32.fetch_sub(1, Ordering::SeqCst);
|
||||
+ }
|
||||
+}
|
||||
+#[cfg(target_pointer_width = "32")]
|
||||
+fn unlock_if_32bit(){
|
||||
+ use core::sync::atomic::Ordering;
|
||||
+ lock32.fetch_sub(1, Ordering::SeqCst);
|
||||
+}
|
||||
+#[cfg(not(target_pointer_width = "32"))]
|
||||
+fn lock_if_32bit(){
|
||||
+}
|
||||
+#[cfg(not(target_pointer_width = "32"))]
|
||||
+fn unlock_if_32bit(){
|
||||
+}
|
||||
|
||||
fn oneshot_decompress(compressed: &[u8], output: &mut [u8]) -> (BrotliResult, usize, usize) {
|
||||
let mut available_in: usize = compressed.len();
|
||||
@@ -255,6 +283,7 @@ fn oneshot(
|
||||
in_buffer_size: usize,
|
||||
out_buffer_size: usize,
|
||||
) -> (BrotliResult, usize, usize) {
|
||||
+ lock_if_32bit();
|
||||
let (success, mut available_in) = oneshot_compress(
|
||||
input,
|
||||
compressed,
|
||||
@@ -268,7 +297,9 @@ fn oneshot(
|
||||
//return (BrotliResult::ResultFailure, 0, 0);
|
||||
available_in = compressed.len();
|
||||
}
|
||||
- oneshot_decompress(&mut compressed[..available_in], output)
|
||||
+ let ret = oneshot_decompress(&mut compressed[..available_in], output);
|
||||
+ unlock_if_32bit();
|
||||
+ ret
|
||||
}
|
||||
|
||||
#[test]
|
||||
--
|
||||
2.46.1
|
||||
|
@ -0,0 +1,13 @@
|
||||
From c14dfea3af98729663eb46577d00d283d90ef6d1 Mon Sep 17 00:00:00 2001
|
||||
From: "Benjamin A. Beasley" <code@musicinmybrain.net>
|
||||
Date: Wed, 2 Oct 2024 07:10:40 -0400
|
||||
Subject: [PATCH] Remove unwanted executable permission from src/enc/test.rs
|
||||
|
||||
---
|
||||
src/enc/test.rs | 0
|
||||
1 file changed, 0 insertions(+), 0 deletions(-)
|
||||
mode change 100755 => 100644 src/enc/test.rs
|
||||
|
||||
diff --git a/src/enc/test.rs b/src/enc/test.rs
|
||||
old mode 100755
|
||||
new mode 100644
|
@ -1,32 +0,0 @@
|
||||
diff --git a/LICENSE b/LICENSE.BSD-3-Clause
|
||||
similarity index 100%
|
||||
rename from LICENSE
|
||||
rename to LICENSE.BSD-3-Clause
|
||||
diff --git a/LICENSE.MIT b/LICENSE.MIT
|
||||
new file mode 100644
|
||||
index 0000000..33b7cdd
|
||||
--- /dev/null
|
||||
+++ b/LICENSE.MIT
|
||||
@@ -0,0 +1,19 @@
|
||||
+Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors.
|
||||
+
|
||||
+Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
+of this software and associated documentation files (the "Software"), to deal
|
||||
+in the Software without restriction, including without limitation the rights
|
||||
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
+copies of the Software, and to permit persons to whom the Software is
|
||||
+furnished to do so, subject to the following conditions:
|
||||
+
|
||||
+The above copyright notice and this permission notice shall be included in
|
||||
+all copies or substantial portions of the Software.
|
||||
+
|
||||
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
+THE SOFTWARE.
|
||||
--
|
||||
2.46.1
|
||||
|
@ -1 +1 @@
|
||||
SHA512 (brotli-6.0.0.crate) = 6d53d3ab653aa3545f0da397796efa1110d445ab8f46456c7501f84ce1c48c99235ae05857f6e91b138521158268691b3a97524f2d3622d69986837dcb64c19d
|
||||
SHA512 (brotli-7.0.0.crate) = 577b2efc324bf461e06af94b8b509a095a917d4ecb2bfd2f3097ab4663ad699317c2fdb0b470344c762589c75dfac073b828603ce5609295ddf1748a39b75622
|
||||
|
Loading…
Reference in new issue