Number base converter: show what a hex or binary bit pattern means as a signed integer (`0xFFFFFFFF` is -1 in 32 bits)
Los mantenedores suelen responder en 1 día
@bhushan4work ya está trabajando en esto.
Desde el 27/11/2026.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 82/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- nextjs, react, typescript
- Área
- frontend
Línea de trabajo
Start by reading fromTwosComplement and formatInteger in lib/number-base.ts and the tests covering them in lib/__tests__/number-base.test.ts (lines 124-145), then look at the twos memo and the two's complement column in NumberBaseConverterClient.tsx. Add the new output card so it renders even when the "doesn't fit" error does, and add the FAQ sentence in lib/tools.ts around line 512. Write NumberBaseConverterClient.test.tsx modelled on UuidGeneratorClient.test.tsx; done means the four hex cases show the signed values, 0x1FF at 8 bits and -5 show the placeholder, and lint, test and build pass.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
The two's complement part only works in one direction. Type -1 with 8-bit selected and you get 11111111. The question people more often have goes the other way: they have a register value, an error code or a hex dump and want to know what it is as a signed integer. Type 0xFFFFFFFF with 32-bit selected and the tool says "4294967295 doesn't fit in a signed 32-bit integer (-2147483648 to 2147483647)" and shows nothing else. 0x80 at 8 bits and 0x80070005 (a Windows HRESULT) at 32 bits do the same.
The logic for this is already written and tested. fromTwosComplement (lib/number-base.ts, line 132) reads binary digits as a signed value of a given width, and lib/__tests__/number-base.test.ts covers it (lines 124 to 145). Nothing in the UI calls it.
What to do
- Add an output card to the two's complement column, for example "As a signed 32-bit value", that reads the input as a bit pattern of the chosen width:
fromTwosComplement(formatInteger(value, 2), bits). Show it for values from 0 to 2^bits - 1. For a negative input, or one wider than the width, show a short placeholder that says why it's empty. - It has to show even when the "doesn't fit" error does, since that's the case it's for. Today the error replaces the whole column (
NumberBaseConverterClient.tsx, lines 269 to 286). - Add a sentence about it to the "How does two's complement work here?" FAQ in
lib/tools.ts(line 512).
Where to look
app/(tools)/number-base-converter/NumberBaseConverterClient.tsx: thetwosmemo (line 91) and the two's complement column (lines 251 to 287)lib/number-base.ts:formatInteger(line 95) andfromTwosComplement(line 132)- The converter has no component test yet. Add
NumberBaseConverterClient.test.tsxnext to it.app/(tools)/uuid-generator/UuidGeneratorClient.test.tsxis a good model.
Acceptance criteria
-
0xFFFFFFFFat 32 bits shows -1,0x80at 8 bits shows -128,0x7Fat 8 bits shows 127, and0x80070005at 32 bits shows -2147024891 -
0x1FFat 8 bits and-5show the placeholder, not a number - The existing outputs and errors don't change
- Tests that fail on the current code
-
npm run lint,npm run testandnpm run buildpass
How to test
In the component test, type into the field labelled "Number", pick the width from "Two's complement width", and check the new card's text for each case above. By hand: npm run dev, open /number-base-converter, enter 0xFFFFFFFF and switch between 8, 16, 32 and 64 bits.
Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off develop, and open your PR against develop with Closes #494 in the description.
- Lenguaje dominante
- TypeScript
- Estrellas
- 1
- Forks
- 9
- Merge medio
- 1 d 8 h
- PR fusionados (30 d)
- 49
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de codercops/toolbelt
-
UUID inspector: decode the timestamp, clock sequence and node of v6 UUIDsQuizá libre de nuevo @joshuaallgaier2-cmd la tomó hace 16 días y no hay ningún pull request abierto. Abiertoenhancement good first issue
Dificultad 3/5 Medio día Aptitud para principiantes 82/100
codercops/toolbelt#495 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Regex tester: add the `v` flag, and step over emoji correctly when it's onPosiblemente ocupada @tnalbant la tomó hace 8 días. Abiertoenhancement good first issue
Dificultad 3/5 Medio día Aptitud para principiantes 82/100
codercops/toolbelt#491 · 4 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 1/100
codercops/toolbelt#101 · 24 comentarios ·
Los mantenedores suelen responder en 1 día
-
[admin] Quarterly content-refresh routineQuizá libre de nuevo @anurag629 la tomó hace 147 días y no hay ningún pull request abierto. Abiertoadmin-only seo
codercops/toolbelt#47 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
[admin] Repurpose guides to dev communities and socialQuizá libre de nuevo @anurag629 la tomó hace 147 días y no hay ningún pull request abierto. Abiertoadmin-only seo
codercops/toolbelt#44 · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de codercops/toolbelt
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Vessel9817/onion-site-template#512 ·
Los mantenedores suelen responder en 1 día
-
nightly-tests
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
BlackBeltTechnology/pi-agent-dashboard#1256 ·
Los mantenedores suelen responder en 1 día
-
approved
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
fritzprix/libr-agent#3266 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
better-auth/better-auth#13101 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día