diff mbox series

[3/4] target/avr: fix avr features processing

Message ID 166883736523.1540909.13390410919692851470.stgit@pasha-ThinkPad-X280
State New
Headers show
Series AVR target fixes | expand

Commit Message

Pavel Dovgalyuk Nov. 19, 2022, 5:56 a.m. UTC
Bit vector for features has 64 bits. This patch fixes bit shifts in
avr_feature and set_avr_feature functions to be 64-bit too.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
---
 target/avr/cpu.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Michael Rolnik Nov. 19, 2022, 4:04 p.m. UTC | #1
Reviewed-by: Michael Rolnik <mrolnik@gmail.com>

On Sat, Nov 19, 2022 at 7:56 AM Pavel Dovgalyuk <pavel.dovgalyuk@ispras.ru>
wrote:

> Bit vector for features has 64 bits. This patch fixes bit shifts in
> avr_feature and set_avr_feature functions to be 64-bit too.
>
> Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
> ---
>  target/avr/cpu.h |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/target/avr/cpu.h b/target/avr/cpu.h
> index cfdc0ecb70..8295e50fa0 100644
> --- a/target/avr/cpu.h
> +++ b/target/avr/cpu.h
> @@ -166,12 +166,12 @@ vaddr avr_cpu_gdb_adjust_breakpoint(CPUState *cpu,
> vaddr addr);
>
>  static inline int avr_feature(CPUAVRState *env, AVRFeature feature)
>  {
> -    return (env->features & (1U << feature)) != 0;
> +    return (env->features & (1ULL << feature)) != 0;
>  }
>
>  static inline void set_avr_feature(CPUAVRState *env, int feature)
>  {
> -    env->features |= (1U << feature);
> +    env->features |= (1ULL << feature);
>  }
>
>  #define cpu_list avr_cpu_list
>
>
diff mbox series

Patch

diff --git a/target/avr/cpu.h b/target/avr/cpu.h
index cfdc0ecb70..8295e50fa0 100644
--- a/target/avr/cpu.h
+++ b/target/avr/cpu.h
@@ -166,12 +166,12 @@  vaddr avr_cpu_gdb_adjust_breakpoint(CPUState *cpu, vaddr addr);
 
 static inline int avr_feature(CPUAVRState *env, AVRFeature feature)
 {
-    return (env->features & (1U << feature)) != 0;
+    return (env->features & (1ULL << feature)) != 0;
 }
 
 static inline void set_avr_feature(CPUAVRState *env, int feature)
 {
-    env->features |= (1U << feature);
+    env->features |= (1ULL << feature);
 }
 
 #define cpu_list avr_cpu_list