Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
a9b28323
Commit
a9b28323
authored
11 years ago
by
Andreas Fischer
Browse files
Options
Downloads
Patches
Plain Diff
Add LargeFileHelper::__construct() verifying that our assumptions hold.
parent
2c36a4b0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/private/largefilehelper.php
+25
-0
25 additions, 0 deletions
lib/private/largefilehelper.php
with
25 additions
and
0 deletions
lib/private/largefilehelper.php
+
25
−
0
View file @
a9b28323
...
...
@@ -12,6 +12,31 @@ namespace OC;
* Helper class for large files on 32-bit platforms.
*/
class
LargeFileHelper
{
/**
* pow(2, 53) as a base-10 string.
* @var string
*/
const
POW_2_53
=
'9007199254740992'
;
/**
* pow(2, 53) - 1 as a base-10 string.
* @var string
*/
const
POW_2_53_MINUS_1
=
'9007199254740991'
;
/**
* @brief Constructor. Checks whether our assumptions hold on the platform
* we are on, throws an exception if they do not hold.
*/
public
function
__construct
()
{
$pow_2_53
=
floatval
(
self
::
POW_2_53_MINUS_1
)
+
1.0
;
if
(
$this
->
formatUnsignedInteger
(
$pow_2_53
)
!==
self
::
POW_2_53
)
{
throw
new
\RunTimeException
(
'This class assumes floats to be double precision or "better".'
);
}
}
/**
* @brief Formats a signed integer or float as an unsigned integer base-10
* string. Passed strings will be checked for being base-10.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment