mirror of
https://github.com/status-im/react-native.git
synced 2025-01-13 02:54:42 +00:00
1151c096da
Summary: This change drops the year from the copyright headers and the LICENSE file. Reviewed By: yungsters Differential Revision: D9727774 fbshipit-source-id: df4fc1e4390733fe774b1a160dd41b4a3d83302a
41 lines
978 B
C++
41 lines
978 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
|