opkg

statically linked package installer
git clone anongit@rnpnr.xyz:opkg.git
Log | Files | Refs | Feed | Submodules | README | LICENSE

0002-Choose-larger-pieces-for-larger-sizes.patch (1123B)


      1 From ed525431bbe23d61c4c8dd4664c13bc19b4db889 Mon Sep 17 00:00:00 2001
      2 From: Michael Forney <mforney@mforney.org>
      3 Date: Mon, 24 Apr 2023 21:09:06 -0700
      4 Subject: [PATCH] Choose larger pieces for larger sizes
      5 
      6 ---
      7  libtransmission/makemeta.c | 21 ++++++++++++++++++---
      8  1 file changed, 18 insertions(+), 3 deletions(-)
      9 
     10 diff --git a/libtransmission/makemeta.c b/libtransmission/makemeta.c
     11 index 713f3e5cb..ae422395d 100644
     12 --- a/libtransmission/makemeta.c
     13 +++ b/libtransmission/makemeta.c
     14 @@ -88,9 +88,24 @@ static struct FileList* getFiles(char const* dir, char const* base, struct FileL
     15  
     16  static uint32_t bestPieceSize(uint64_t totalSize)
     17  {
     18 -    uint32_t const KiB = 1024;
     19 -    uint32_t const MiB = 1048576;
     20 -    uint32_t const GiB = 1073741824;
     21 +    uint64_t const KiB = 1024;
     22 +    uint64_t const MiB = 1048576;
     23 +    uint64_t const GiB = 1073741824;
     24 +
     25 +    if (totalSize >= 16 * GiB)
     26 +    {
     27 +        return 16 * MiB;
     28 +    }
     29 +
     30 +    if (totalSize >= 8 * GiB)
     31 +    {
     32 +        return 8 * MiB;
     33 +    }
     34 +
     35 +    if (totalSize >= 4 * GiB)
     36 +    {
     37 +        return 4 * MiB;
     38 +    }
     39  
     40      if (totalSize >= 2 * GiB)
     41      {
     42 -- 
     43 2.37.3
     44