File tree Expand file tree Collapse file tree 3 files changed +10
-10
lines changed Expand file tree Collapse file tree 3 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -89,15 +89,15 @@ pub fn make_enum_definition(enum_: &Enum) -> TokenStream {
89
89
}
90
90
}
91
91
} ;
92
- enum_ord_type = quote ! { u64 } ;
92
+ enum_ord_type = quote ! { i64 } ;
93
93
self_as_trait = quote ! { <Self as crate :: obj:: EngineBitfield > } ;
94
94
engine_impl = quote ! {
95
95
impl crate :: obj:: EngineBitfield for #rust_enum_name {
96
- fn try_from_ord( ord: u64 ) -> Option <Self > {
96
+ fn try_from_ord( ord: i64 ) -> Option <Self > {
97
97
Some ( Self { ord } )
98
98
}
99
99
100
- fn ord( self ) -> u64 {
100
+ fn ord( self ) -> i64 {
101
101
self . ord
102
102
}
103
103
}
@@ -128,7 +128,7 @@ pub fn make_enum_definition(enum_: &Enum) -> TokenStream {
128
128
129
129
// Enumerator ordinal stored as i32, since that's enough to hold all current values and the default repr in C++.
130
130
// Public interface is i64 though, for consistency (and possibly forward compatibility?).
131
- // Bitfield ordinals are stored as u64. See also: https://github.com/godotengine/godot-cpp/pull/1320
131
+ // Bitfield ordinals are stored as i64.
132
132
quote ! {
133
133
#[ repr( transparent) ]
134
134
#[ derive( #( #derives ) , * ) ]
@@ -172,8 +172,8 @@ pub fn make_enumerator_ord(ord: i32) -> Literal {
172
172
// ----------------------------------------------------------------------------------------------------------------------------------------------
173
173
// Implementation
174
174
175
- fn make_bitfield_flag_ord ( ord : u64 ) -> Literal {
176
- Literal :: u64_suffixed ( ord)
175
+ fn make_bitfield_flag_ord ( ord : i64 ) -> Literal {
176
+ Literal :: i64_suffixed ( ord)
177
177
}
178
178
179
179
fn make_enumerator_definition ( enumerator : & Enumerator ) -> TokenStream {
Original file line number Diff line number Diff line change @@ -201,7 +201,7 @@ pub struct Enumerator {
201
201
}
202
202
pub enum EnumeratorValue {
203
203
Enum ( i32 ) ,
204
- Bitfield ( u64 ) ,
204
+ Bitfield ( i64 ) ,
205
205
}
206
206
207
207
impl EnumeratorValue {
Original file line number Diff line number Diff line change @@ -161,12 +161,12 @@ pub trait EngineEnum: Copy {
161
161
162
162
/// Auto-implemented for all engine-provided bitfields.
163
163
pub trait EngineBitfield : Copy {
164
- fn try_from_ord ( ord : u64 ) -> Option < Self > ;
164
+ fn try_from_ord ( ord : i64 ) -> Option < Self > ;
165
165
166
166
/// Ordinal value of the bit flag, as specified in Godot.
167
- fn ord ( self ) -> u64 ;
167
+ fn ord ( self ) -> i64 ;
168
168
169
- fn from_ord ( ord : u64 ) -> Self {
169
+ fn from_ord ( ord : i64 ) -> Self {
170
170
Self :: try_from_ord ( ord)
171
171
. unwrap_or_else ( || panic ! ( "ordinal {ord} does not map to any valid bit flag" ) )
172
172
}
You can’t perform that action at this time.
0 commit comments