yutotnh / spirit

モータードライバ用ライブラリ
https://yutotnh.github.io/spirit/
MIT License
2 stars 2 forks source link

Feature: get_range_value(), set_range_value() の引数と返り値を変更する #177

Closed yutotnh closed 1 year ago

yutotnh commented 1 year ago

なぜ機能が欲しいのか

現在は、エラーチェックが指定した範囲が baffuer の幅を超えていたら 返り値に UINT32_MAX を返しているがそれと、返り値の型が uint32 であるため、 31bit が安全に値を取得できる最大になる

https://github.com/yutotnh/spirit/blob/62dd6467d199d7455a4ade670a203816b6d399a1/include/bit.h#L9-L17

もしかしたら、前述の変更に伴って同じような以下の関数も変更したほうがいいかも

https://github.com/yutotnh/spirit/blob/62dd6467d199d7455a4ade670a203816b6d399a1/include/bit.h#L19-L29

提案の説明

get_range_value() の返り値をエラーチェックの結果にして、出力として値を返す引数を追加する。

その他

yutotnh commented 1 year ago

256 で対応したのでcloseします