Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: src/wasm/wasm-external-refs.cc

Issue 2013393002: Fix wrong endianness of wasm header in WasmModuleWriter on big-endian platforms (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/wasm/encoder.cc ('K') | « src/wasm/wasm-external-refs.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <math.h> 5 #include <math.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <limits> 8 #include <limits>
9 9
10 #include "include/v8config.h" 10 #include "include/v8config.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 } 187 }
188 188
189 uint32_t word32_popcnt_wrapper(uint32_t* input) { 189 uint32_t word32_popcnt_wrapper(uint32_t* input) {
190 return static_cast<uint32_t>(base::bits::CountPopulation(*input)); 190 return static_cast<uint32_t>(base::bits::CountPopulation(*input));
191 } 191 }
192 192
193 uint32_t word64_popcnt_wrapper(uint64_t* input) { 193 uint32_t word64_popcnt_wrapper(uint64_t* input) {
194 return static_cast<uint32_t>(base::bits::CountPopulation(*input)); 194 return static_cast<uint32_t>(base::bits::CountPopulation(*input));
195 } 195 }
196 196
197 uint32_t word32_to_little_endianness(const uint32_t* input) {
198 #if defined(V8_TARGET_LITTLE_ENDIAN)
199 return *input;
200 #elif defined(V8_TARGET_BIG_ENDIAN)
201 return base::bits::ChangeEndianness(*input);
202 #else
203 #error Unknown endianness
204 #endif
205 }
206
207 uint32_t word32_to_natural_endianness(const uint32_t* input) {
208 #if defined(V8_TARGET_LITTLE_ENDIAN)
209 return *input;
210 #elif defined(V8_TARGET_BIG_ENDIAN)
211 return base::bits::ChangeEndianness(*input);
212 #else
213 #error Unknown endianness
214 #endif
215 }
216
197 } // namespace wasm 217 } // namespace wasm
198 } // namespace internal 218 } // namespace internal
199 } // namespace v8 219 } // namespace v8
OLDNEW
« src/wasm/encoder.cc ('K') | « src/wasm/wasm-external-refs.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698