This is an automated email from the ASF dual-hosted git repository.

chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fury.git


The following commit(s) were added to refs/heads/main by this push:
     new 7de0cdd5 fix(rust): replace `(value << 8) | (value >> 8)` with 
`value.rotate_right(8)` (#1841)
7de0cdd5 is described below

commit 7de0cdd528eca60b3988bc2d1e05e163079be159
Author: Shawn Yang <[email protected]>
AuthorDate: Thu Sep 12 23:41:18 2024 +0800

    fix(rust): replace `(value << 8) | (value >> 8)` with 
`value.rotate_right(8)` (#1841)
    
    <!--
    **Thanks for contributing to Fury.**
    
    **If this is your first time opening a PR on fury, you can refer to
    
[CONTRIBUTING.md](https://github.com/apache/fury/blob/main/CONTRIBUTING.md).**
    
    Contribution Checklist
    
    - The **Apache Fury (incubating)** community has restrictions on the
    naming of pr titles. You can also find instructions in
    [CONTRIBUTING.md](https://github.com/apache/fury/blob/main/CONTRIBUTING.md).
    
    - Fury has a strong focus on performance. If the PR you submit will have
    an impact on performance, please benchmark it first and provide the
    benchmark result here.
    -->
    
    ## What does this PR do?
    
    <!-- Describe the purpose of this PR. -->
    
    ## Related issues
    
    <!--
    Is there any related issue? Please attach here.
    
    - #xxxx0
    - #xxxx1
    - #xxxx2
    -->
    
    ## Does this PR introduce any user-facing change?
    
    <!--
    If any user-facing interface changes, please [open an
    issue](https://github.com/apache/fury/issues/new/choose) describing the
    need to do so and update the document if necessary.
    -->
    
    - [ ] Does this PR introduce any public API change?
    - [ ] Does this PR introduce any binary protocol compatibility change?
    
    ## Benchmark
    
    <!--
    When the PR has an impact on performance (if you don't know whether the
    PR will have an impact on performance, you can submit the PR first, and
    if it will have impact on performance, the code reviewer will explain
    it), be sure to attach a benchmark data here.
    -->
---
 rust/fury-core/src/util.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rust/fury-core/src/util.rs b/rust/fury-core/src/util.rs
index 31194cef..458a7f21 100644
--- a/rust/fury-core/src/util.rs
+++ b/rust/fury-core/src/util.rs
@@ -27,7 +27,7 @@ pub const EPOCH: NaiveDate = match 
NaiveDate::from_ymd_opt(1970, 1, 1) {
 
 // Swapping the high 8 bits and the low 8 bits of a 16-bit value
 fn swap_endian(value: u16) -> u16 {
-    (value << 8) | (value >> 8)
+    value.rotate_right(8)
 }
 
 pub fn to_utf8(utf16: &[u16], is_little_endian: bool) -> Result<Vec<u8>, 
String> {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to