bungeman@google.com | 8ec9956 | 2012-02-07 21:30:21 +0000 | [diff] [blame] | 1 | /* |
| 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 | |
| 11 | uint32_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 | } |