blob: 1301a06e02179418f57d339f4e73d68659214de3 [file] [log] [blame]
bungeman@google.com8ec99562012-02-07 21:30:21 +00001/*
2 * Copyright 2012 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "SkOTTableTypes.h"
9#include "SkOTUtils.h"
10
11uint32_t SkOTUtils::CalcTableChecksum(SK_OT_ULONG *data, size_t length) {
12 uint32_t sum = 0;
13 SK_OT_ULONG *dataEnd = data + ((length + 3) & ~3) / sizeof(SK_OT_ULONG);
14 for (; data < dataEnd; ++data) {
15 sum += SkEndian_SwapBE32(*data);
16 }
17 return sum;
18}