<commit_before>/*
 * Copyright 2012 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkChecksum_DEFINED
#define SkChecksum_DEFINED

#include "SkTypes.h"

#if !defined(SK_PREFER_32BIT_CHECKSUM)
#define SK_PREFER_32BIT_CHECKSUM 0
#endif

enum {
    ChecksumRotateBits = 17
};

#define SkCHECKSUM_MASH(CHECKSUM, NEW_CHUNK) \
    CHECKSUM = (((CHECKSUM) >> (sizeof(CHECKSUM)*8 - ChecksumRotateBits)) + \
        ((CHECKSUM) << ChecksumRotateBits)) ^ (NEW_CHUNK);


/**
 *  Compute a 64-bit checksum for a given data block
 *
 *  @param data Memory address of the data block to be processed. Must be
 *      32-bit aligned
 *  @param size Size of the data block in bytes. Must be a multiple of 8.
 *  @return checksum result
 */
inline uint64_t SkComputeChecksum64(const uint64_t* ptr, size_t size) {
    SkASSERT(SkIsAlign8(size));
    // Strict 8-byte alignment is not required on ptr. On current
    // CPUs there is no measurable performance difference between 32-bit
    // and 64-bit aligned access to uint64_t data
    SkASSERT(SkIsAlign4((intptr_t)ptr));

    const uint64_t* stop = ptr + (size >> 3);
    uint64_t result = 0;
    while (ptr < stop) {
        SkCHECKSUM_MASH(result, *ptr);
        ptr++;
    }
    return result;
}

/**
 *  Compute a 32-bit checksum for a given data block
 *
 *  @param data Memory address of the data block to be processed. Must be
 *      32-bit aligned.
 *  @param size Size of the data block in bytes. Must be a multiple of 4.
 *  @return checksum result
 */
inline uint32_t SkComputeChecksum32(const uint32_t* ptr, size_t size) {
    SkASSERT(SkIsAlign4(size));
    SkASSERT(SkIsAlign4((intptr_t)ptr));

    const uint32_t* stop = ptr + (size >> 2);
    uint32_t result = 0;
    while (ptr < stop) {
        SkCHECKSUM_MASH(result, *ptr);
        ptr++;
    }
    return result;
}
#endif<commit_msg>Added EOF marker to address clang++ error<commit_after>/*
 * Copyright 2012 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkChecksum_DEFINED
#define SkChecksum_DEFINED

#include "SkTypes.h"

#if !defined(SK_PREFER_32BIT_CHECKSUM)
#define SK_PREFER_32BIT_CHECKSUM 0
#endif

enum {
    ChecksumRotateBits = 17
};

#define SkCHECKSUM_MASH(CHECKSUM, NEW_CHUNK) \
    CHECKSUM = (((CHECKSUM) >> (sizeof(CHECKSUM)*8 - ChecksumRotateBits)) + \
        ((CHECKSUM) << ChecksumRotateBits)) ^ (NEW_CHUNK);


/**
 *  Compute a 64-bit checksum for a given data block
 *
 *  @param data Memory address of the data block to be processed. Must be
 *      32-bit aligned
 *  @param size Size of the data block in bytes. Must be a multiple of 8.
 *  @return checksum result
 */
inline uint64_t SkComputeChecksum64(const uint64_t* ptr, size_t size) {
    SkASSERT(SkIsAlign8(size));
    // Strict 8-byte alignment is not required on ptr. On current
    // CPUs there is no measurable performance difference between 32-bit
    // and 64-bit aligned access to uint64_t data
    SkASSERT(SkIsAlign4((intptr_t)ptr));

    const uint64_t* stop = ptr + (size >> 3);
    uint64_t result = 0;
    while (ptr < stop) {
        SkCHECKSUM_MASH(result, *ptr);
        ptr++;
    }
    return result;
}

/**
 *  Compute a 32-bit checksum for a given data block
 *
 *  @param data Memory address of the data block to be processed. Must be
 *      32-bit aligned.
 *  @param size Size of the data block in bytes. Must be a multiple of 4.
 *  @return checksum result
 */
inline uint32_t SkComputeChecksum32(const uint32_t* ptr, size_t size) {
    SkASSERT(SkIsAlign4(size));
    SkASSERT(SkIsAlign4((intptr_t)ptr));

    const uint32_t* stop = ptr + (size >> 2);
    uint32_t result = 0;
    while (ptr < stop) {
        SkCHECKSUM_MASH(result, *ptr);
        ptr++;
    }
    return result;
}
#endif

{'fraction_non_alphanumeric': 0.10157257025006446, 'fraction_numerical': 0.029389017788089715, 'mean_word_length': 3.172043010752688, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6168502', 'n_tokens_mistral': 1385, 'n_tokens_neox': 1300, 'n_words': 429}