Skip to content

Fixed a bug when calculating USB size - #199

Open
Ricca665 wants to merge 2 commits into
nullmoth:mainfrom
Ricca665:main
Open

Ricca665 wants to merge 2 commits into
nullmoth:mainfrom
Ricca665:main

Conversation

@Ricca665

@Ricca665 Ricca665 commented Nov 22, 2026 •

Copy link
Copy Markdown
  • fixed a bug that incorrectly calculated USB size
  • fixed an old unit test that used the old formula

What was wrong
When doing the 32GB Flash drive calculation, Windows uses GiB when calculating size, however reports the size in GB
When the program checked for the size it assumed it was using GB instead of GiB
So for example 1TB gets read by windows as 931GB
This bug therefore prevented real 32GB flash drives from working

What this changes
Corrects the expression
So instead of it doing:
32 * 1024 * 1024 * 1024
it does
31 * 1000 * 1000 * 1000
As windows sees a 32GB flash drive as around 28.9 "GB" (stupid i know)

How I tested it (your PC, the stick, what you ran or did)
MSI Cyborg 15 A13V
32GB Flash drive (Kingston DataTraveler G4)
Ran the project in visual studio, went through and used said 32GB flash drive

Fixes

  • Fixed the bug so now it can use 32GB flash drives.
  • I wrote this change and this description myself (not an AI tool), and I can explain every line.

Signed-off-by: Ricca665 <riccy10210@gmail.com>
Signed-off-by: Ricca665 <riccy10210@gmail.com>
@Ricca665
Ricca665 requested a review from nullmoth as a code owner November 22, 2026 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant