@@ -47,12 +47,11 @@ struct aws_future_impl {
4747 aws_future_impl_result_release_fn * release ;
4848 } result_dtor ;
4949 int error_code ;
50- /* sum of bit fields should be 32 */
51- #define BIT_COUNT_FOR_SIZEOF_RESULT 27
52- unsigned int sizeof_result : BIT_COUNT_FOR_SIZEOF_RESULT ;
53- unsigned int type : 3 ; /* aws_future_type */
54- unsigned int is_done : 1 ;
55- unsigned int owns_result : 1 ;
50+
51+ size_t sizeof_result ;
52+ enum aws_future_type type ;
53+ bool is_done ;
54+ bool owns_result ;
5655};
5756
5857static void s_future_impl_result_dtor (struct aws_future_impl * future , void * result_addr ) {
@@ -108,9 +107,7 @@ static struct aws_future_impl *s_future_impl_new(struct aws_allocator *alloc, si
108107 struct aws_future_impl * future = aws_mem_calloc (alloc , 1 , total_size );
109108 future -> alloc = alloc ;
110109
111- /* we store sizeof_result in a bit field, ensure the number will fit */
112- AWS_ASSERT (sizeof_result <= (UINT_MAX >> (32 - BIT_COUNT_FOR_SIZEOF_RESULT )));
113- future -> sizeof_result = (unsigned int )sizeof_result ;
110+ future -> sizeof_result = sizeof_result ;
114111
115112 aws_ref_count_init (& future -> ref_count , future , s_future_impl_destroy );
116113 aws_mutex_init (& future -> lock );
@@ -186,7 +183,7 @@ bool aws_future_impl_is_done(const struct aws_future_impl *future) {
186183
187184 /* BEGIN CRITICAL SECTION */
188185 aws_mutex_lock (mutable_lock );
189- bool is_done = future -> is_done != 0 ;
186+ bool is_done = future -> is_done ;
190187 aws_mutex_unlock (mutable_lock );
191188 /* END CRITICAL SECTION */
192189
@@ -362,7 +359,7 @@ static bool s_future_impl_register_callback(
362359
363360 AWS_FATAL_ASSERT (future -> callback .fn == NULL && "Future done callback must only be set once" );
364361
365- bool already_done = future -> is_done != 0 ;
362+ bool already_done = future -> is_done ;
366363
367364 /* if not done, store callback for later */
368365 if (!already_done ) {
@@ -456,7 +453,7 @@ void aws_future_impl_register_channel_callback(
456453
457454static bool s_future_impl_is_done_pred (void * user_data ) {
458455 struct aws_future_impl * future = user_data ;
459- return future -> is_done != 0 ;
456+ return future -> is_done ;
460457}
461458
462459bool aws_future_impl_wait (const struct aws_future_impl * future , uint64_t timeout_ns ) {
0 commit comments