From 223f40820aa3c952ac89ed938bbac17bef700eba Mon Sep 17 00:00:00 2001 From: Baptiste Wicht Date: Tue, 13 Sep 2016 19:16:01 +0200 Subject: [PATCH] Cleanup --- tstl/include/bit_field.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tstl/include/bit_field.hpp b/tstl/include/bit_field.hpp index af5b9415..ecb83cfc 100644 --- a/tstl/include/bit_field.hpp +++ b/tstl/include/bit_field.hpp @@ -22,8 +22,10 @@ struct bit_field { return (*value >> Position) & ((1ULL << Size) - 1); } - bit_field& operator=(T new_value){ - S mask = ((1ULL << Size) - 1) << Position; + bit_field& operator=(T new_value_real){ + S new_value(new_value_real); + + size_t mask = ((S(1) << Size) - 1) << Position; *value = (*value & ~mask) | ((new_value << Position) & mask); return *this; }