<commit_before>/*
 * Copyright 2006 The Android Open Source Project
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkTypes_DEFINED
#define SkTypes_DEFINED

// IWYU pragma: begin_exports

// In at least two known scenarios when using GCC with libc++:
//  * GCC 4.8 targeting ARMv7 with NEON
//  * GCC 4.9 targeting ARMv8 64 bit
// we need to typedef float float32_t (or include <arm_neon.h> which does that)
// before #including <memory>. This makes no sense.  I'm not very interested in
// understanding why... these are old, bizarre platform configuration that we
// should just let die.
#include <ciso646>  // Include something innocuous to define _LIBCPP_VERISON if it's libc++.
#if defined(__GNUC__) && __GNUC__ == 4 \
 && ((defined(SK_CPU_ARM32) && defined(SK_ARM_HAS_NEON)) || defined(SK_CPU_ARM64)) \
 && defined(_LIBCPP_VERSION)
    typedef float float32_t;
    #include <memory>
#endif

#include "SkPreConfig.h"
#include "SkUserConfig.h"
#include "SkPostConfig.h"
#include <stddef.h>
#include <stdint.h>
// IWYU pragma: end_exports

#include <string.h>

/**
 *  sk_careful_memcpy() is just like memcpy(), but guards against undefined behavior.
 *
 * It is undefined behavior to call memcpy() with null dst or src, even if len is 0.
 * If an optimizer is "smart" enough, it can exploit this to do unexpected things.
 *     memcpy(dst, src, 0);
 *     if (src) {
 *         printf("%x\n", *src);<commit_msg>Corrected test for gcc/libc++ workaround.<commit_after>/*
 * Copyright 2006 The Android Open Source Project
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkTypes_DEFINED
#define SkTypes_DEFINED

// IWYU pragma: begin_exports

// In at least two known scenarios when using GCC with libc++:
//  * GCC 4.8 targeting ARMv7 with NEON
//  * GCC 4.9 targeting ARMv8 64 bit
// we need to typedef float float32_t (or include <arm_neon.h> which does that)
// before #including <memory>. This makes no sense.  I'm not very interested in
// understanding why... these are old, bizarre platform configuration that we
// should just let die.
// See https://llvm.org/bugs/show_bug.cgi?id=25608 .
#include <ciso646>  // Include something innocuous to define _LIBCPP_VERISON if it's libc++.
#if defined(__GNUC__) && __GNUC__ == 4 \
 && ((defined(__arm__) && (defined(__ARM_NEON__) || defined(__ARM_NEON))) || defined(__aarch64__)) \
 && defined(_LIBCPP_VERSION)
    typedef float float32_t;
    #include <memory>
#endif

#include "SkPreConfig.h"
#include "SkUserConfig.h"
#include "SkPostConfig.h"
#include <stddef.h>
#include <stdint.h>
// IWYU pragma: end_exports

#include <string.h>

/**
 *  sk_careful_memcpy() is just like memcpy(), but guards against undefined behavior.
 *
 * It is undefined behavior to call memcpy() with null dst or src, even if len is 0.
 * If an optimizer is "smart" enough, it can exploit this to do unexpected things.
 *     memcpy(dst, src, 0);
 *     if (src) {
 *         printf("%x\n", *src);
{'fraction_non_alphanumeric': 0.11527189840442853, 'fraction_numerical': 0.017909475740801043, 'mean_word_length': 3.7554179566563466, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 1, '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': '5487049', 'n_tokens_mistral': 1039, 'n_tokens_neox': 970, 'n_words': 372}