mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
ede2c5031f
Summary: We are moving towards 100%-prettified files. That's the first step when we apply Clang Format for `ReactCommon`. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D20110895 fbshipit-source-id: 0a0ce4997cf1c3721b0b07ef78c1a57ce87d20f9
43 lines
996 B
C++
43 lines
996 B
C++
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#include "JSBundleType.h"
|
|
|
|
#include <folly/Bits.h>
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
static uint32_t constexpr RAMBundleMagicNumber = 0xFB0BD1E5;
|
|
static uint32_t constexpr BCBundleMagicNumber = 0x6D657300;
|
|
|
|
ScriptTag parseTypeFromHeader(const BundleHeader &header) {
|
|
switch (folly::Endian::little(header.magic)) {
|
|
case RAMBundleMagicNumber:
|
|
return ScriptTag::RAMBundle;
|
|
case BCBundleMagicNumber:
|
|
return ScriptTag::BCBundle;
|
|
default:
|
|
return ScriptTag::String;
|
|
}
|
|
}
|
|
|
|
const char *stringForScriptTag(const ScriptTag &tag) {
|
|
switch (tag) {
|
|
case ScriptTag::String:
|
|
return "String";
|
|
case ScriptTag::RAMBundle:
|
|
return "RAM Bundle";
|
|
case ScriptTag::BCBundle:
|
|
return "BC Bundle";
|
|
}
|
|
return "";
|
|
}
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|