Skip to content

[doubling] get#200

Merged
ia7ck merged 2 commits intomasterfrom
re-doubling
Feb 7, 2026
Merged

[doubling] get#200
ia7ck merged 2 commits intomasterfrom
re-doubling

Conversation

@ia7ck
Copy link
Owner

@ia7ck ia7ck commented Feb 7, 2026

  • max_steps = 0 で使うことはなさそう
  • get()

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

libs/doublingDoubling に、内部のダブリングテーブル(2^k 遷移)へ直接アクセスする get() を追加し、max_steps == 0 の取り扱いを明確化(現在は拒否)するPRです。

Changes:

  • Doubling::new()max_steps > 0assert! で強制
  • Doubling::get(start, k) を追加して 2^k 遷移を参照で返却
  • プロパティテストの入力範囲を max_steps >= 1 に変更し、新しい前提条件に合わせる

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +80 to 83
assert!(max_steps > 0);

let log2_max_steps = max_steps.ilog2() as usize;

Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doubling::new previously supported max_steps == 0 (and fold(start, 0, ...) still works), but this change introduces an unconditional panic for that input. If this crate is consumed externally, this is an API-breaking behavior change; consider keeping the old handling (treat 0 as a valid value) or documenting the new precondition clearly (e.g., in rustdoc / changelog) and making tests reflect the intended contract.

Suggested change
assert!(max_steps > 0);
let log2_max_steps = max_steps.ilog2() as usize;
let log2_max_steps = if max_steps == 0 {
0
} else {
max_steps.ilog2() as usize
};

Copilot uses AI. Check for mistakes.
@ia7ck ia7ck merged commit 4f487b0 into master Feb 7, 2026
12 checks passed
@ia7ck ia7ck deleted the re-doubling branch February 7, 2026 14:25
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

Comments