mirror of
https://github.com/status-im/react-native.git
synced 2025-01-27 09:45:04 +00:00
Shortcut JSBigFileString in when no offset is used
Reviewed By: mhorowitz Differential Revision: D5227225 fbshipit-source-id: a50688c8b873bf08ea10fafaa143df130f59dfaa
This commit is contained in:
parent
eb6ba0b041
commit
8497ec297c
@ -112,20 +112,25 @@ public:
|
||||
: m_fd {-1}
|
||||
, m_data {nullptr}
|
||||
{
|
||||
folly::checkUnixError(
|
||||
m_fd = dup(fd),
|
||||
"Could not duplicate file descriptor");
|
||||
folly::checkUnixError(m_fd = dup(fd),
|
||||
"Could not duplicate file descriptor");
|
||||
|
||||
// Offsets given to mmap must be page aligend. We abstract away that
|
||||
// restriction by sending a page aligned offset to mmap, and keeping track
|
||||
// of the offset within the page that we must alter the mmap pointer by to
|
||||
// get the final desired offset.
|
||||
auto ps = getpagesize();
|
||||
auto d = lldiv(offset, ps);
|
||||
if (offset != 0) {
|
||||
const static auto ps = getpagesize();
|
||||
auto d = lldiv(offset, ps);
|
||||
|
||||
m_mapOff = d.quot;
|
||||
m_pageOff = d.rem;
|
||||
m_size = size + m_pageOff;
|
||||
m_mapOff = d.quot;
|
||||
m_pageOff = d.rem;
|
||||
m_size = size + m_pageOff;
|
||||
} else {
|
||||
m_mapOff = 0;
|
||||
m_pageOff = 0;
|
||||
m_size = size;
|
||||
}
|
||||
}
|
||||
|
||||
~JSBigFileString() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user