Skip to content

Commit

Permalink
pre-commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
joaander committed Sep 5, 2024
1 parent c366448 commit 6806c0f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
18 changes: 10 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@ repos:
- id: check-toml
- id: check-yaml
- id: check-case-conflict
- id: fix-encoding-pragma
args:
- --remove
- id: mixed-line-ending
# actionlint fails to build on mac...
# - repo: https://github.com/rhysd/actionlint
# rev: v1.6.27
# hooks:
# - id: actionlint
- repo: https://github.com/asottile/pyupgrade
rev: 'v3.16.0'
hooks:
- id: pyupgrade
args:
- --py39-plus
- repo: https://github.com/rhysd/actionlint
rev: v1.7.1
hooks:
- id: actionlint
- repo: https://github.com/glotzerlab/fix-license-header
rev: v0.3.2
hooks:
Expand Down
12 changes: 7 additions & 5 deletions gsd/gsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
#include <errno.h>
#include <fcntl.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

#include "gsd.h"

Expand Down Expand Up @@ -163,9 +163,10 @@ inline static ssize_t gsd_io_pwrite_retry(int fd, const void* buf, size_t count,
size_t to_write = count - total_bytes_written;
#if defined(_WIN32) || defined(__APPLE__)
// win32 and apple raise an error for writes greater than INT_MAX
if (to_write > INT_MAX / 2) {
if (to_write > INT_MAX / 2)
{
to_write = INT_MAX / 2;
}
}
#endif

errno = 0;
Expand Down Expand Up @@ -206,9 +207,10 @@ inline static ssize_t gsd_io_pread_retry(int fd, void* buf, size_t count, int64_
size_t to_read = count - total_bytes_read;
#if defined(_WIN32) || defined(__APPLE__)
// win32 and apple raise errors for reads greater than INT_MAX
if (to_read > INT_MAX / 2) {
if (to_read > INT_MAX / 2)
{
to_read = INT_MAX / 2;
}
}
#endif

errno = 0;
Expand Down
3 changes: 1 addition & 2 deletions scripts/benchmark-write.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ int main(int argc, char** argv) // NOLINT

const double us = 1e-6;
std::cout << "Write time: " << time_per_key / us << " microseconds/key." << '\n';
std::cout << "Write time: " << time_per_key / us * n_keys << " microseconds/frame."
<< '\n';
std::cout << "Write time: " << time_per_key / us * n_keys << " microseconds/frame." << '\n';

const double mb_per_second
= double(key_size * 8 + static_cast<const size_t>(32) * static_cast<const size_t>(2))
Expand Down

0 comments on commit 6806c0f

Please sign in to comment.