Number base converter: show what a hex or binary bit pattern means as a signed integer (`0xFFFFFFFF` is -1 in 32 bits)
维护者通常 1 天内回复
@bhushan4work 已经在做这个了。
开始于 2026年11月27日。
评估
- 难度
- 3/5
- 预计耗时
- 半天
- 新手友好度
- 82/100
- Issue 类型
- 功能
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- nextjs, react, typescript
- 领域
- frontend
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- TypeScript
- 星标
- 1
- 派生
- 9
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 49
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
codercops/toolbelt 的其他 Issue
-
UUID inspector: decode the timestamp, clock sequence and node of v6 UUIDs可能重新可做 @joshuaallgaier2-cmd 于 16 天前认领,目前没有进行中的 PR。 未关闭enhancement good first issue
难度 3/5 半天 新手友好度 82/100
codercops/toolbelt#495 · 2 条评论 ·
维护者通常 1 天内回复
-
Regex tester: add the `v` flag, and step over emoji correctly when it's on可能已有人在做 @tnalbant 于 8 天前认领。 未关闭enhancement good first issue
难度 3/5 半天 新手友好度 82/100
codercops/toolbelt#491 · 4 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 1/100
codercops/toolbelt#101 · 24 条评论 ·
维护者通常 1 天内回复
-
[admin] Quarterly content-refresh routine可能重新可做 @anurag629 于 147 天前认领,目前没有进行中的 PR。 未关闭admin-only seo
codercops/toolbelt#47 · 已指派 1 人 ·
维护者通常 1 天内回复
-
[admin] Repurpose guides to dev communities and social可能重新可做 @anurag629 于 147 天前认领,目前没有进行中的 PR。 未关闭admin-only seo
codercops/toolbelt#44 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 codercops/toolbelt 的全部 Issue
相似的 Issue
-
clawsweeper:intake:bug clawsweeper:intake:needs-environment
难度 2/5 1-3 小时 新手友好度 82/100
openclaw/openclaw#212827 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
KT-2245 e2e specs that call the backend directly fall back to the developer's own Kronn on :3140未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Use one constant for the 10,000-character input limit可能已有人在做 @NginxL 今天认领。 未关闭good first issue refactor
难度 2/5 1-3 小时 新手友好度 78/100
aniru-dh21/snap-validate#51 ·
维护者通常 1 天内回复
-
dependencies effort: small good first issue priority: low
难度 1/5 1-3 小时 新手友好度 88/100
TMHSDigital/screencast-mcp#509 ·
维护者通常 1 天内回复
-
from-review tech-debt testing
难度 2/5 1-3 小时 新手友好度 82/100
blamechris/chroxy#9520 ·
维护者通常 1 天内回复