@@ -67,14 +67,13 @@ COMPILER_RT_VISIBILITY
67
67
uint64_t __llvm_profile_get_num_data (const __llvm_profile_data * Begin ,
68
68
const __llvm_profile_data * End ) {
69
69
intptr_t BeginI = (intptr_t )Begin , EndI = (intptr_t )End ;
70
- return ((EndI + sizeof (__llvm_profile_data ) - 1 ) - BeginI ) /
71
- sizeof (__llvm_profile_data );
70
+ return (EndI - BeginI ) / sizeof (__llvm_profile_data );
72
71
}
73
72
74
73
COMPILER_RT_VISIBILITY
75
74
uint64_t __llvm_profile_get_data_size (const __llvm_profile_data * Begin ,
76
75
const __llvm_profile_data * End ) {
77
- return __llvm_profile_get_num_data ( Begin , End ) * sizeof ( __llvm_profile_data );
76
+ return ( intptr_t )( End ) - ( intptr_t )( Begin );
78
77
}
79
78
80
79
// Counts the number of `VTableProfData` elements within the range of [Begin,
@@ -106,25 +105,23 @@ COMPILER_RT_VISIBILITY size_t __llvm_profile_counter_entry_size(void) {
106
105
COMPILER_RT_VISIBILITY
107
106
uint64_t __llvm_profile_get_num_counters (const char * Begin , const char * End ) {
108
107
intptr_t BeginI = (intptr_t )Begin , EndI = (intptr_t )End ;
109
- return ((EndI + __llvm_profile_counter_entry_size () - 1 ) - BeginI ) /
110
- __llvm_profile_counter_entry_size ();
108
+ return (EndI - BeginI ) / __llvm_profile_counter_entry_size ();
111
109
}
112
110
113
111
COMPILER_RT_VISIBILITY
114
112
uint64_t __llvm_profile_get_counters_size (const char * Begin , const char * End ) {
115
- return __llvm_profile_get_num_counters (Begin , End ) *
116
- __llvm_profile_counter_entry_size ();
113
+ return (intptr_t )(End ) - (intptr_t )(Begin );
117
114
}
118
115
119
116
COMPILER_RT_VISIBILITY
120
117
uint64_t __llvm_profile_get_num_bitmap_bytes (const char * Begin ,
121
118
const char * End ) {
122
- return (End - Begin );
119
+ return (intptr_t )( End ) - ( intptr_t )( Begin );
123
120
}
124
121
125
122
COMPILER_RT_VISIBILITY
126
123
uint64_t __llvm_profile_get_name_size (const char * Begin , const char * End ) {
127
- return End - Begin ;
124
+ return ( intptr_t )( End ) - ( intptr_t )( Begin ) ;
128
125
}
129
126
130
127
/// Calculate the number of padding bytes needed to add to \p Offset in order
0 commit comments