Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix: Correct sign extension handling in months_days_micros struct #543

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

TCeason
Copy link
Collaborator

@TCeason TCeason commented Dec 19, 2024

Summary:

The MonthsDaysMicros struct’s new method incorrectly handled negative days and microseconds values, leading to incorrect bitwise representation and extraction. This PR addresses these issues by:

Casting days to u32 before casting to i128 to prevent sign extension. Casting microseconds to u64 before casting to i128 to prevent sign extension.

Summary:

The MonthsDaysMicros struct’s new method incorrectly handled negative days and microseconds values, leading to incorrect bitwise representation and extraction. This PR addresses these issues by:

Casting days to u32 before casting to i128 to prevent sign extension.
Casting microseconds to u64 before casting to i128 to prevent sign extension.
@TCeason TCeason requested a review from sundy-li December 19, 2024 06:29
@TCeason TCeason merged commit e589e93 into databendlabs:main Dec 19, 2024
34 checks passed
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