Skip to content

feat(libc): implement __powidf2 as the compiler-rt integer power - #2845

Closed
danzaio wants to merge 1 commit into
boykopovar:mainfrom
danzaio:feat/powidf2-compilerrt
Closed

danzaio wants to merge 1 commit into
boykopovar:mainfrom
danzaio:feat/powidf2-compilerrt

Conversation

@danzaio

@danzaio danzaio commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

PR body draft — feat/powidf2-compilerrt (DRAFT, needs Dan's sentence)

TODO Dan: one sentence in your words for the top of ### What (CONTRIBUTING requires it).

What

[TBD Dan's sentence.]

Cyberpunk 2077 imports __powidf2 and the export threw for every call. It is the compiler helper for integer powers, implemented here exactly as LLVM compiler-rt writes it, so the NID keeps pointing at the same behavior any clang-built title expects. Non-exact cases like 10^-5 can differ from pow in the last bit; the test pins exact cases bit-for-bit and checks the rest against pow with a tight tolerance.

Tested

ctest -R guest_math passes: exact powers, zero and negative-zero bases, NaN and infinity to the zeroth, INT_MIN and INT_MAX exponents, one bit-exact check, and two tolerance checks. Without the fix the test does not link (no such symbol); with it, it passes. Two mutations (shift instead of divide, dropping the reciprocal) both fail. check_conventions.py pending at push time.

Checklist

  • Based on current main; no other open PR implements the same functions (rebase at open time; feat(libc): implement __powidf2 and _WStoul #1980 covered this export and was closed without merge)
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

Cyberpunk 2077 imports __powidf2 and the export threw for every call. It is the compiler helper for integer powers, implemented as LLVM compiler-rt writes it. Listed in boykopovar#2010; console behavior unverified and recorded in TechnicalDebt.
@github-actions github-actions Bot added the intake paused Closed while PR intake is limited to authors with at least 10 PRs merged into main label Oct 10, 2026
@github-actions

Copy link
Copy Markdown

Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.

@github-actions github-actions Bot closed this Oct 10, 2026
@github-actions

Copy link
Copy Markdown

Progress report (57f96fd → 0ef2120)

📈 System libraries: 84.55% (+0.03%, +1 implemented, -1 removed functions)

✅ 1 implemented
Library Name
libc __powidf2_nid_postfix
🗑️ 1 removed
Library Name
libc libcCyberUnknown08

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

intake paused Closed while PR intake is limited to authors with at least 10 PRs merged into main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant