blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 2 247 | content_id stringlengths 40 40 | detected_licenses listlengths 0 57 | license_type stringclasses 2 values | repo_name stringlengths 4 111 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 58 | visit_date timestamp[ns]date 2015-07-25 18:16:41 2023-09-06 10:45:08 | revision_date timestamp[ns]date 1970-01-14 14:03:36 2023-09-06 06:22:19 | committer_date timestamp[ns]date 1970-01-14 14:03:36 2023-09-06 06:22:19 | github_id int64 3.89k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 25 values | gha_event_created_at timestamp[ns]date 2012-06-07 00:51:45 2023-09-14 21:58:52 ⌀ | gha_created_at timestamp[ns]date 2008-03-27 23:40:48 2023-08-24 19:49:39 ⌀ | gha_language stringclasses 159 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 10.5M | extension stringclasses 111 values | filename stringlengths 1 195 | text stringlengths 7 10.5M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
35e00d90ff83c774c5a891a572e2dc4f1b0b7270 | 6870bbc775ae44536f4967a999ffb1a73feec4ed | /include/web/default_startup.hpp | 5bc73ca68109a3fea59faa04d79930084617014c | [
"MIT"
] | permissive | Gscienty/rwg_websocket | d16660acb5423877f854560a2b7c23296b9eeb6d | fea57348f0f8509909192df70bd7d3cb20c32029 | refs/heads/master | 2020-03-31T11:33:58.891173 | 2018-12-11T14:17:00 | 2018-12-11T14:17:00 | 152,182,011 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 324 | hpp | default_startup.hpp | #ifndef _RWG_WEB_DEFAULT_STARTUP_
#define _RWG_WEB_DEFAULT_STARTUP_
#include <string>
#include "web/req.hpp"
#include "web/res.hpp"
namespace rwg_web {
class default_startup {
private:
const std::string _uri;
public:
default_startup(const std::string);
void run(rwg_web::req &, rwg_web::res &);
};
}
#endif
|
942fc4531c62f53182a5e46ec333c7d08c12a0f7 | 2b2266da35079e4c597c76da6777c5ca3bd08a97 | /source/VulkanRenderer.cpp | 2f8b59e9a5a8f0bf94b7edf2c025d4eb28ab9ab7 | [] | no_license | Michael-Sjogren/VulkanTest | 721c833b73dbd251958fabc7c08dacd2b2b50b52 | 58902fdfa0fb6627989fb41ae0195b9f71c89344 | refs/heads/main | 2023-01-04T12:01:43.524755 | 2020-10-28T13:32:06 | 2020-10-28T13:32:06 | 307,366,682 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 17,576 | cpp | VulkanRenderer.cpp | #include "../includes/VulkanRenderer.h"
int VulkanRenderer::Init(GLFWwindow *newWindow)
{
window = newWindow;
try
{
CreateInstance();
CreateSurface();
GetPhysicalDevice();
CreateLogicalDevice();
CreateSwapChain();
}
catch (const std::exception &e)
{
std::printf("ERROR %s \n", e.what());
return EXIT_FAILURE;
}
return 0;
}
void VulkanRenderer::CreateInstance()
{
// information of the application itself
// most data here wont affect the program is for developer convinece
if (enableValidationLayers && !CheckValidationLayerSupport())
{
throw std::runtime_error("Validation Layers requested, but not available!");
}
VkApplicationInfo applicationInfo = {};
applicationInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
applicationInfo.apiVersion = VK_API_VERSION_1_1;
applicationInfo.pApplicationName = "Vulkan Test Application";
applicationInfo.applicationVersion = VK_MAKE_VERSION(1, 0, 0);
applicationInfo.pEngineName = "None";
applicationInfo.engineVersion = VK_MAKE_VERSION(1, 0, 0);
// creation information for a vk instance witch is a vulkan instance.
VkInstanceCreateInfo createInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
createInfo.pApplicationInfo = &applicationInfo;
// create a list to hold the instance extenstions
auto extentions = std::vector<const char *>();
uint32_t glfwExtCount = 0;
const char **glfwExtensions;
glfwExtensions = glfwGetRequiredInstanceExtensions(&glfwExtCount);
// add GLFW extenstion to list of extenstions
for (size_t i = 0; i < glfwExtCount; ++i)
{
extentions.push_back(glfwExtensions[i]);
}
// check if INSTANCE extentions are supported
if (!CheckInstanceExtentionSupport(&extentions))
{
throw std::runtime_error("VKInstance does not support required extentions!");
}
createInfo.enabledExtensionCount = static_cast<uint32_t>(extentions.size());
createInfo.ppEnabledExtensionNames = extentions.data();
// if validation layers are activated
if (enableValidationLayers)
{
createInfo.enabledLayerCount = static_cast<uint32_t>(validationLayers.size());
createInfo.ppEnabledLayerNames = validationLayers.data();
std::cout << "Validation layers enabled!"
<< "\n";
}
else
{
createInfo.enabledLayerCount = 0;
}
// Create instance
VkResult result = vkCreateInstance(&createInfo, nullptr, &instance);
if (result != VK_SUCCESS)
{
throw std::runtime_error("Failed to create a vulkan instance");
}
}
void VulkanRenderer::CreateLogicalDevice()
{
// get queuefamily indicies for the choosen physical device
auto indices = GetQueueFamilies(mainDevice.physicalDevice);
// vector for queue creating information and set for family indicies
std::vector<VkDeviceQueueCreateInfo> queueCreateInfos;
std::set<int> queueFamilyIndices = {indices.graphicsFamily, indices.presentationFamily};
for (int queueFamilyIndex : queueFamilyIndices)
{
VkDeviceQueueCreateInfo queueCreateInfo = {};
queueCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
queueCreateInfo.queueFamilyIndex = queueFamilyIndex; // the index of the family to create a queue from
queueCreateInfo.queueCount = 1; // number of queues to create.
float priority = 1.0f;
queueCreateInfo.pQueuePriorities = &priority; // vulkan needs to know how to handle multpible queues, so decide prio 1 is highest 0 lowest
queueCreateInfos.push_back(queueCreateInfo);
}
// information to create logical device
VkDeviceCreateInfo deviceInfo = {};
deviceInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
deviceInfo.queueCreateInfoCount = static_cast<uint32_t>(queueCreateInfos.size()); // number of queue create infos
deviceInfo.pQueueCreateInfos = queueCreateInfos.data(); // list of queue create infos so device can create required queues
deviceInfo.enabledExtensionCount = static_cast<uint32_t>(deviceExtensions.size()); // number of enabled logical device extenstions
deviceInfo.ppEnabledExtensionNames = deviceExtensions.data(); // List of enabled logical device extentions
// physical device features the logical device will be using
VkPhysicalDeviceFeatures deviceFeatures = {};
deviceInfo.pEnabledFeatures = &deviceFeatures; // Physical device features logical device will use
VkResult result = vkCreateDevice(mainDevice.physicalDevice, &deviceInfo, nullptr, &mainDevice.logicalDevice);
if (result != VK_SUCCESS)
{
throw std::runtime_error("Failed to create a Logical Device!");
}
// queues are created at the same time as the dice...
// so we want a refernce to queues
// From given logical device, of given queue family of given index 0 since only one queue, place refernce in given
vkGetDeviceQueue(mainDevice.logicalDevice, indices.graphicsFamily, 0, &graphicsQueue);
vkGetDeviceQueue(mainDevice.logicalDevice, indices.presentationFamily, 0, &presenetationQueue);
}
void VulkanRenderer::CreateSurface()
{
// creating a surface create info struct, runs the create surface function
VkResult result = glfwCreateWindowSurface(instance, window, nullptr, &surface);
if (result != VK_SUCCESS)
{
throw std::runtime_error("Failed to create a VK surface with glfw");
}
}
void VulkanRenderer::CreateSwapChain(){
SwapChainDetails details = GetSwapChainDetails(mainDevice.physicalDevice);
// 1 choose best surface format
auto surfaceFormat = ChooseBestSurfaceFormat(details.formats);
// 2 choose best presentation mode
auto presentationMode = ChooseBestPresentationMode(details.presentationModes);
// 3 choose swap chain image resoultion
auto extent = ChooseSwapExtent(details.surfaceCapabilites);
uint32_t minImageCount = details.surfaceCapabilites.minImageCount +1;
if (details.surfaceCapabilites.maxImageCount > 0
&& details.surfaceCapabilites.maxImageCount < minImageCount)
{
minImageCount = details.surfaceCapabilites.maxImageCount;
}
VkSwapchainCreateInfoKHR swapCreateInfo = {};
swapCreateInfo.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
swapCreateInfo.surface = surface;
swapCreateInfo.imageFormat = surfaceFormat.format;
swapCreateInfo.imageColorSpace = surfaceFormat.colorSpace;
swapCreateInfo.presentMode = presentationMode;
swapCreateInfo.imageExtent = extent;
swapCreateInfo.minImageCount = minImageCount;
swapCreateInfo.imageArrayLayers = 1;
swapCreateInfo.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
swapCreateInfo.preTransform = details.surfaceCapabilites.currentTransform;
swapCreateInfo.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR; // how to handle blending images , with external graphics eg other windows
swapCreateInfo.clipped = VK_TRUE; // whether to clip parts of image not visible by screen
// get queuefamily indices
auto indices = GetQueueFamilies(mainDevice.physicalDevice);
// If graphics and presentation families are diffrent, then swapchain must let images be shared between families
if(indices.graphicsFamily != indices.presentationFamily)
{
uint32_t queueFamilyIndices[] = {
(uint32_t)indices.graphicsFamily,
(uint32_t)indices.presentationFamily,
};
swapCreateInfo.imageSharingMode = VK_SHARING_MODE_CONCURRENT; // image share handling
swapCreateInfo.queueFamilyIndexCount = 2; // number if queues to share images between
swapCreateInfo.pQueueFamilyIndices = queueFamilyIndices; // array of queues to share between
}
else
{
swapCreateInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
swapCreateInfo.queueFamilyIndexCount = 0;
swapCreateInfo.pQueueFamilyIndices = nullptr;
}
// If old been destroyed and this one replace it the link old one to quickly hand over responsibles
swapCreateInfo.oldSwapchain = VK_NULL_HANDLE;
// create swapchain
auto result = vkCreateSwapchainKHR(mainDevice.logicalDevice, &swapCreateInfo , nullptr , &swapChain);
if (result != VK_SUCCESS) {
throw std::runtime_error("Failed to create a swapchain");
}
swapChainImageFormat = surfaceFormat.format;
swapChainExtent = extent;
}
bool VulkanRenderer::CheckValidationLayerSupport()
{
uint32_t layerCount = 0;
vkEnumerateInstanceLayerProperties(&layerCount, nullptr);
std::vector<VkLayerProperties> availableLayers(layerCount);
vkEnumerateInstanceLayerProperties(&layerCount, availableLayers.data());
for (const char *layerName : validationLayers)
{
bool layerFound = false;
for (const auto &layerProperties : availableLayers)
{
if (strcmp(layerName, layerProperties.layerName) == 0)
{
layerFound = true;
break;
}
}
if (!layerFound)
{
return false;
}
}
return true;
}
bool VulkanRenderer::CheckDeviceExtensionSupport(VkPhysicalDevice device)
{
uint32_t extensionCount = 0;
vkEnumerateDeviceExtensionProperties(device, nullptr, &extensionCount, nullptr);
if (extensionCount == 0)
{
return false;
}
std::vector<VkExtensionProperties> extensions(extensionCount);
vkEnumerateDeviceExtensionProperties(device, nullptr, &extensionCount, extensions.data());
// check for extension
for (const auto &deviceExtension : deviceExtensions)
{
bool hasExtension = false;
for (const auto &extension : extensions)
{
if (strcmp(deviceExtension, extension.extensionName) == 0)
{
hasExtension = true;
break;
}
}
if (!hasExtension)
{
return false;
}
}
return true;
}
bool VulkanRenderer::CheckInstanceExtentionSupport(std::vector<const char *> *checkExtentions)
{
uint32_t extensionCount = 0;
vkEnumerateInstanceExtensionProperties(nullptr, &extensionCount, nullptr);
if (extensionCount == 0)
{
return false;
}
std::vector<VkExtensionProperties> extentions(extensionCount);
vkEnumerateInstanceExtensionProperties(nullptr, &extensionCount, extentions.data());
// check if given is in list of available extentions
for (const auto &e : *checkExtentions)
{
bool hasExtenstion = false;
for (const auto &extention : extentions)
{
if ((strcmp(e, extention.extensionName)))
{
hasExtenstion = true;
break;
}
}
if (!hasExtenstion)
return false;
}
return true;
}
void VulkanRenderer::Cleanup()
{
vkDestroySwapchainKHR(mainDevice.logicalDevice , swapChain , nullptr);
vkDestroySurfaceKHR(instance, surface, nullptr);
vkDestroyDevice(mainDevice.logicalDevice, nullptr);
vkDestroyInstance(instance, nullptr);
}
bool VulkanRenderer::CheckDeviceSuitable(VkPhysicalDevice device)
{
// information about the device itself (id, name , type , vendor , etc)
/**
VkPhysicalDeviceProperties deviceProperties;
vkGetPhysicalDeviceProperties(device,&deviceProperties);
VkPhysicalDeviceFeatures deviceFeatures;
vkGetPhysicalDeviceFeatures(device ,&deviceFeatures);
**/
QueueFamilyIndices indicies = GetQueueFamilies(device);
bool extensionSupported = CheckDeviceExtensionSupport(device);
bool swapChainValid = false;
if (extensionSupported)
{
SwapChainDetails swapChainDetails = GetSwapChainDetails(device);
swapChainValid = !swapChainDetails.formats.empty() && !swapChainDetails.presentationModes.empty();
}
return indicies.IsValid() && extensionSupported && swapChainValid;
}
void VulkanRenderer::GetPhysicalDevice()
{
uint32_t deviceCount = 0;
vkEnumeratePhysicalDevices(instance, &deviceCount, nullptr);
if (deviceCount == 0)
{
throw std::runtime_error("Cant find any GPU's that support vulkan instance.");
}
std::vector<VkPhysicalDevice> deviceList(deviceCount);
vkEnumeratePhysicalDevices(instance, &deviceCount, deviceList.data());
for (const auto &device : deviceList)
{
if (CheckDeviceSuitable(device))
{
mainDevice.physicalDevice = device;
break;
}
}
}
QueueFamilyIndices VulkanRenderer::GetQueueFamilies(VkPhysicalDevice device)
{
QueueFamilyIndices indices;
uint32_t queueFamilyCount = 0;
vkGetPhysicalDeviceQueueFamilyProperties(device, &queueFamilyCount, VK_NULL_HANDLE);
auto queueFamilyList = std::vector<VkQueueFamilyProperties>(queueFamilyCount);
vkGetPhysicalDeviceQueueFamilyProperties(device, &queueFamilyCount, queueFamilyList.data());
int index = 0;
for (const auto &queueFamily : queueFamilyList)
{
// fist check if queue family atleast have one 1 queue i nthat family could have no queue
// Queue can be multible types defined thhrough bitfield. need to bitwise and with vk_queue_*_bit to check if has -
// required type
if (queueFamily.queueCount > 0 && queueFamily.queueFlags & VK_QUEUE_GRAPHICS_BIT)
{
indices.graphicsFamily = index; // if queuefamily is valid get index
}
// CHECK IF QUEUEFAMILY SUPPORTS PRESENTATION
VkBool32 presentationSupport = false;
vkGetPhysicalDeviceSurfaceSupportKHR(device, index, surface, &presentationSupport);
// check if queue is presentation type (can be both graphics and presentation)
if (queueFamily.queueCount > 0 && presentationSupport)
{
indices.presentationFamily = index;
}
// check if queuefamily indicies is in a valid state, stop searching if so.
if (indices.IsValid())
{
break;
}
index++;
}
return indices;
}
SwapChainDetails VulkanRenderer::GetSwapChainDetails(VkPhysicalDevice device)
{
SwapChainDetails details;
// get surface capabillites for the given surface on the given physical device
vkGetPhysicalDeviceSurfaceCapabilitiesKHR(device, surface, &details.surfaceCapabilites);
// formats
uint32_t formatCount = 0;
vkGetPhysicalDeviceSurfaceFormatsKHR(device, surface, &formatCount, nullptr);
if (formatCount != 0)
{
details.formats.resize(formatCount);
vkGetPhysicalDeviceSurfaceFormatsKHR(device, surface, &formatCount, details.formats.data());
}
// presentation modes
uint32_t modeCount = 0;
vkGetPhysicalDeviceSurfacePresentModesKHR(device, surface, &modeCount, nullptr);
if (modeCount != 0)
{
details.presentationModes.resize(modeCount);
vkGetPhysicalDeviceSurfacePresentModesKHR(device, surface, &modeCount, details.presentationModes.data());
}
return details;
}
// best format is subjective, but ours will be:
// Format : VK_FORMAT_R8G8B8A8_UNORM or VK_FORMAT_B8G8R8A8_UNORM
// ColorSpace : VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
VkSurfaceFormatKHR VulkanRenderer::ChooseBestSurfaceFormat(const std::vector<VkSurfaceFormatKHR> &formats)
{
// if only 1 format available and is undefine , then this means all formats are available (no restrictions)
if(formats.size() == 1 && formats[0].format == VK_FORMAT_UNDEFINED)
{
return {VK_FORMAT_R8G8B8A8_UNORM , VK_COLOR_SPACE_SRGB_NONLINEAR_KHR};
}
// if restricted search for optimal format
for(const auto &f : formats)
{
if(f.format == (VK_FORMAT_R8G8B8A8_UNORM || VK_FORMAT_B8G8R8A8_UNORM)
&& f.colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR)
{
return f;
}
}
// else return the first
return formats[0];
}
VkExtent2D VulkanRenderer::ChooseSwapExtent(const VkSurfaceCapabilitiesKHR &surfaceCapabillites)
{
// if current extent is at numberic limits, then extent can vary. otherwise it is the size of the window.
if(surfaceCapabillites.currentExtent.width != std::numeric_limits<uint32_t>::max())
{
return surfaceCapabillites.currentExtent;
}
// if it varies set extents manually
// get window size
int width, height;
glfwGetFramebufferSize(window , &width , &height);
// create new extent using window size
VkExtent2D newExtent = {};
newExtent.width = static_cast<uint32_t>(width);
newExtent.height = static_cast<uint32_t>(height);
// saurface also defines max and min so make sure within boundaries by clamping value
newExtent.width = std::max(surfaceCapabillites.minImageExtent.width, std::min(surfaceCapabillites.maxImageExtent.width, newExtent.width));
newExtent.height = std::max(surfaceCapabillites.minImageExtent.height, std::min(surfaceCapabillites.maxImageExtent.height, newExtent.height));
return newExtent;
}
VkPresentModeKHR VulkanRenderer::ChooseBestPresentationMode(const std::vector<VkPresentModeKHR> &modes)
{
// look for mailbox presentation mode
for(const auto &mode : modes)
{
if(mode == VK_PRESENT_MODE_MAILBOX_KHR) return mode;
}
// if not found return fifo as default , garanteed to be available
return VK_PRESENT_MODE_FIFO_KHR;
} |
c9d8f8aab4fd4bc28cf4c9fc6d8ffe6f90b9b227 | b0774c65de745a687721a0861094dd3c1a9a9fc3 | /engine/video/IVideo.h | af0c44e44505ce92aec4e8b750019a7b6c32b0e1 | [] | no_license | crackgame/easy2d | 17b6a7e40fd10399527b0b2e4d8f77ef5c2d837a | 1251c63cf54d4ced58218bd8165eddaa75a5aa1d | refs/heads/master | 2021-01-01T19:34:01.345958 | 2012-12-27T12:46:55 | 2012-12-27T12:46:55 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 720 | h | IVideo.h | #ifndef _IVIDEO_H_
#define _IVIDEO_H_
#include "IShader.h"
#include "ITexture.h"
namespace easy2d {
class IVideo
{
public:
enum EVideoType
{
VideoGLES2,
VideoD3D9,
};
public:
virtual ~IVideo(){}
virtual bool create(void* hWindow, unsigned int width, unsigned int height, bool isFullScreen) = 0;
virtual void clear(unsigned int color = 0x00000000) = 0;
virtual void present() = 0;
virtual void render() = 0;
virtual void resize(unsigned int width, unsigned int height) = 0;
// 工厂函数
virtual IShader* createShader() = 0;
virtual ITexture* createTexture() = 0;
};
// 全局函数
extern IVideo* CreateVideoGLES2();
extern void ReleaseVideo(IVideo** pVideo);
} // namespace easy2d
#endif |
a3033139a46d8854438af8a6ce9223ebd45d2ecb | 7e17ad0a18623e326cb63808ce7935516a7bfff5 | /src/tests/test09/server.cpp | f44593ab3973544a34f7fb582a9e2adf0d921f54 | [
"BSD-2-Clause",
"MIT"
] | permissive | aclamk/ruros | 9bca91267ce8a48ab690d2dfa27a28f55e39f456 | 786229fdd2d05ddfaee5ed7bd489d5d0506e7c71 | refs/heads/master | 2016-08-03T10:43:23.244845 | 2015-09-17T13:51:22 | 2015-09-17T13:51:22 | 37,932,545 | 0 | 1 | null | 2015-07-07T16:03:06 | 2015-06-23T17:03:29 | C++ | UTF-8 | C++ | false | false | 1,561 | cpp | server.cpp | #include "ruros.h"
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include "unix_io.h"
#include "serialize.h"
using namespace ruros;
namespace BB
{
Result Mult(const int& a,const int& b,int& result);
}
namespace AA
{
#include "serv1.server.cpp"
#include "serv2.client.cpp"
Result Add(const int& a,const int& b,int& result)
{
//printf("Add %d %d\n",a,b);
AA::Mult(a,b,result);
return Success;
}
}
namespace BB
{
#include "serv1.client.cpp"
#include "serv2.server.cpp"
Result Mult(const int& a,const int& b,int& result)
{
result=a*b;
//printf("Mult %d %d\n",a,b);
return Success;
}
}
pthread_t serv_thr;
void* serv_thread(void* arg)
{
int fd,fda;
fd=create_server_socket("./socket");
listen(fd,10);
while(true)
{
fda=accept(fd,NULL,0);
UnixIO* io=new UnixIO(fda);
ConnectionRef conn;
conn=newConnection(io);
bool b;
sleep(1);
b=requestService(conn, &AA::serv2_client_side);
if(!b) exit(-1);
}
return 0;
}
int main(int argc, char** argv)
{
publishService(&AA::serv1_server_side);
publishService(&BB::serv2_server_side);
pthread_create(&serv_thr,NULL,serv_thread,NULL);
sleep(1);
int fd;
fd=connect_server("./socket");
UnixIO* io=new UnixIO(fd);
ConnectionRef conn;
conn=newConnection(io);
if(conn.get()==NULL) return -1;
bool b;
b=requestService(conn, &BB::serv1_client_side);
if(!b) return -2;
sleep(2);
//Register();
int i;
int iloc=1;
int irpc=1;
for(i=0;i<10000;i++)
{
BB::Add(irpc,3,irpc);
iloc=iloc*3;
if(irpc!=iloc)
return -3;
}
return 0;
}
|
97fe47360f730fdcc31eaec493f28ca324f218db | ea160cd88a0528e6675a5032dda1ab1684e6352a | /Gaussian_elimination.cpp | d511b2d7a6cabeca9b4a727bdb37355faba56ab8 | [] | no_license | Kavisankar/Data-Structures-and-Algorithms | 277d30f2b95a8465845611e2a2740c34ca3ecdcb | c182e9df8dede3ba7f1e7997b52e381f5e3ad196 | refs/heads/master | 2022-10-07T05:36:11.391911 | 2020-06-05T15:30:02 | 2020-06-05T15:30:02 | 258,092,308 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 865 | cpp | Gaussian_elimination.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<vector<double> > equation(n,vector<double>(n+1));
for(int i=0;i<n;i++){
for(int j=0;j<=n;j++){
cin>>equation[i][j];
}
}
for(int i=0;i<n;i++){
if(equation[i][i]==0){
int c=1;
while(i+c<n && equation[i+c][i]==0)
c++;
if(i+c==n)
assert(false);
swap(equation[i],equation[i+c]);
}
for(int j=0;j<n;j++){
if(i==j)
continue;
double factor = equation[j][i]/equation[i][i];
for(int k=0;k<=n;k++){
equation[j][k] -= equation[i][k]*factor;
}
}
}
for(int i=0;i<n;i++){
printf("%.6f ",equation[i][n]/equation[i][i]);
}
return 0;
}
|
d09c2b08efe6c86c410a786155bd991285f01e4f | 82cc4eea98806f3024b5b16696a7af258e2a24a4 | /src/prometheus/registry.h | 5d37c04d81055c420118d47ca32fa988f94a5134 | [
"MIT",
"GPL-2.0-only",
"Apache-2.0",
"GPL-1.0-or-later",
"BSD-3-Clause"
] | permissive | puer99miss/Xapiand | 72e7497f37f315c354ae12b360ea8b14bc31ee00 | 480f312709d40e2b1deb244ff0761b79846ed608 | refs/heads/master | 2020-05-18T23:33:48.464001 | 2019-05-02T18:29:01 | 2019-05-02T18:29:01 | 184,714,481 | 1 | 0 | MIT | 2019-05-03T07:21:22 | 2019-05-03T07:21:22 | null | UTF-8 | C++ | false | false | 1,074 | h | registry.h | #pragma once
#include <map>
#include <memory>
#include <mutex>
#include "client_metric.h"
#include "collectable.h"
#include "family.h"
#include "histogram.h"
#include "summary.h"
namespace prometheus {
class Registry : public Collectable {
public:
// collectable
std::vector<MetricFamily> Collect() override;
Family<Counter>& AddCounter(const std::string& name, const std::string& help,
const std::map<std::string, std::string>& constant_labels);
Family<Gauge>& AddGauge(const std::string& name, const std::string& help,
const std::map<std::string, std::string>& constant_labels);
Family<Histogram>& AddHistogram(
const std::string& name, const std::string& help,
const std::map<std::string, std::string>& constant_labels);
Family<Summary>& AddSummary(const std::string& name, const std::string& help,
const std::map<std::string, std::string>& constant_labels);
private:
std::vector<std::unique_ptr<Collectable>> collectables_;
std::mutex mutex_;
};
}
|
b3d80026ec48581d7d514397ff535323388e4810 | 01940d46f04f2b7be932cc2f9aedc19e8dc6d8cd | /Server/StaticNFrame/NFComm/NFCore/NFShm.h | 0101ecc0f379d688426640f6d90f1af8b41d8068 | [] | no_license | xuebai5/StaticNFrame | 07861ff59c59826c92a4731042ecc35356488fa6 | 05421e35bdb81fdda01050cdb8549375d6ddacc8 | refs/heads/master | 2022-04-01T13:37:53.479759 | 2020-01-03T07:35:33 | 2020-01-03T07:35:33 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 3,670 | h | NFShm.h | // -------------------------------------------------------------------------
// @FileName : NFShm.h
// @Author : GaoYi
// @Date : 2019-3-6
// @Email : 445267987@qq.com
// @Module : NFCore
//
// -------------------------------------------------------------------------
#pragma once
#include "NFPlatform.h"
#include "NFException.hpp"
#if NF_PLATFORM == NF_PLATFORM_WIN
#include <Windows.h>
typedef long key_t;
#else
#include <sys/ipc.h>
#include <sys/shm.h>
#endif
/////////////////////////////////////////////////
/**
* @file NFShm.h
* @brief 共享内存封装类.
*
*/
/////////////////////////////////////////////////
/**
* @brief 共享内存异常类.
*/
struct NFShmException : public NFException
{
NFShmException(const std::string &buffer) : NFException(buffer) {};
NFShmException(const std::string &buffer, int err) : NFException(buffer, err) {};
~NFShmException() throw() {};
};
/**
* @brief 共享内存连接类,说明:
* 1 用于连接共享内存, 共享内存的权限是 0666
* 2 _bOwner=false: 析够时不detach共享内存
* 3 _bOwner=true: 析够时detach共享内存
*/
class _NFExport NFShm
{
public:
/**
* @brief 构造函数.
*
* @param bOwner 是否拥有共享内存,默认为false
*/
#if NF_PLATFORM == NF_PLATFORM_WIN
NFShm(bool bOwner = false) : _bOwner(bOwner), _shmSize(0), _shmKey(0), _bCreate(true), _pshm(nullptr), _shemID(nullptr), _fileID(nullptr){}
#else
NFShm(bool bOwner = false) : _bOwner(bOwner), _shmSize(0), _shmKey(0), _bCreate(true), _pshm(nullptr), _shemID(-1) {}
#endif
/**
* @brief 构造函数.
*
* @param iShmSize 共享内存大小
* @param iKey 共享内存Key
* @throws TC_Shm_Exception
*/
NFShm(size_t iShmSize, key_t iKey, bool bOwner = false);
/**
* @brief 析构函数.
*/
~NFShm();
/**
* @brief 初始化.
*
* @param iShmSize 共享内存大小
* @param iKey 共享内存Key
* @param bOwner 是否拥有共享内存
* @throws TC_Shm_Exception
* @return Ξ
*/
void init(size_t iShmSize, key_t iKey, bool bOwner = false);
/**
* @brief 判断共享内存的类型,生成的共享内存,还是连接上的共享内存
* 如果是生成的共享内存,此时可以根据需要做初始化
*
* @return true,生成共享内存; false, 连接上的共享内存
*/
bool iscreate() { return _bCreate; }
/**
* @brief 获取共享内存的指针.
*
* @return void* 共享内存指针
*/
void *getPointer() { return _pshm; }
/**
* @brief 获取共享内存Key.
*
* @return key_t* ,共享内存key
*/
key_t getkey() { return _shmKey; }
/**
* @brief 获取共享内存ID.
*
* @return int ,共享内存Id
*/
#if NF_PLATFORM == NF_PLATFORM_WIN
HANDLE getid() { return _shemID; }
#else
int getid() { return _shemID; }
#endif
/**
* @brief 获取共享内存大小.
*
* return size_t,共享内存大小
*/
size_t size() { return _shmSize; }
/**
* @brief 解除共享内存,在当前进程中解除共享内存
* 共享内存在当前进程中无效
* @return int
*/
int detach();
/**
* @brief 删除共享内存.
*
* 完全删除共享内存
*/
int del();
protected:
/**
* 是否拥有共享内存
*/
bool _bOwner;
/**
* 共享内存大小
*/
size_t _shmSize;
/**
* 共享内存key
*/
key_t _shmKey;
/**
* 是否是生成的共享内存
*/
bool _bCreate;
/**
* 共享内存
*/
void *_pshm;
/**
* 共享内存id
*/
#if NF_PLATFORM == NF_PLATFORM_WIN
HANDLE _shemID;
HANDLE _fileID;
#else
int _shemID;
#endif
};
|
2ae91121ae6fb05756f16f8578a7397e44e42519 | 00add89b1c9712db1a29a73f34864854a7738686 | /packages/monte_carlo/collision/electron/test/tstAdjointElectronMaterial.cpp | da7c03db12ff82eb3332e4bd9c7a0ba651133d91 | [
"BSD-3-Clause"
] | permissive | FRENSIE/FRENSIE | a4f533faa02e456ec641815886bc530a53f525f9 | 1735b1c8841f23d415a4998743515c56f980f654 | refs/heads/master | 2021-11-19T02:37:26.311426 | 2021-09-08T11:51:24 | 2021-09-08T11:51:24 | 7,826,404 | 11 | 6 | NOASSERTION | 2021-09-08T11:51:25 | 2013-01-25T19:03:09 | C++ | UTF-8 | C++ | false | false | 16,977 | cpp | tstAdjointElectronMaterial.cpp | //---------------------------------------------------------------------------//
//!
//! \file tstAdjointElectronMaterial.cpp
//! \author Luke Kersting
//! \brief Adjoint electron material class unit tests
//!
//---------------------------------------------------------------------------//
// Std Lib Includes
#include <iostream>
// FRENSIE Includes
#include "MonteCarlo_AdjointElectroatomFactory.hpp"
#include "MonteCarlo_AdjointElectronMaterial.hpp"
#include "Data_ScatteringCenterPropertiesDatabase.hpp"
#include "Utility_UnitTestHarnessWithMain.hpp"
//---------------------------------------------------------------------------//
// Testing Variables.
//---------------------------------------------------------------------------//
std::shared_ptr<MonteCarlo::AdjointElectronMaterial> material;
double num_density;
//---------------------------------------------------------------------------//
// Tests.
//---------------------------------------------------------------------------//
// Check that the material id can be returned
FRENSIE_UNIT_TEST( AdjointElectronMaterial, getId )
{
FRENSIE_CHECK_EQUAL( material->getId(), 0 );
}
//---------------------------------------------------------------------------//
// Check that the critical line energies can be returned
FRENSIE_UNIT_TEST( AdjointElectronMaterial, getCriticalLineEnergies )
{
const std::vector<double>& critical_line_energies =
material->getCriticalLineEnergies();
FRENSIE_REQUIRE_EQUAL( critical_line_energies.size(), 1 );
FRENSIE_REQUIRE_EQUAL( critical_line_energies[0], 20.0 );
}
//---------------------------------------------------------------------------//
// Check that the number density can be returned
FRENSIE_UNIT_TEST( AdjointElectronMaterial, getNumberDensity )
{
FRENSIE_CHECK_FLOATING_EQUALITY( material->getNumberDensity(),
num_density,
1e-12 );
}
//---------------------------------------------------------------------------//
// Check that the macroscopic total cross section can be returned
FRENSIE_UNIT_TEST( AdjointElectronMaterial, getMacroscopicTotalCrossSection )
{
double cross_section = material->getMacroscopicTotalCrossSection( 1e-5 );
FRENSIE_CHECK_FLOATING_EQUALITY( cross_section, 4.280728254654968262e+10*num_density, 1e-12 );
cross_section = material->getMacroscopicTotalCrossSection( 1e-3 );
FRENSIE_CHECK_FLOATING_EQUALITY( cross_section, 4.609051066694104671e+07*num_density, 1e-12 );
cross_section = material->getMacroscopicTotalCrossSection( 20.0 );
FRENSIE_CHECK_FLOATING_EQUALITY( cross_section, 9.798205883647680457e+04*num_density, 1e-12 );
}
//---------------------------------------------------------------------------//
// Check that the macroscopic absorption cross section can be returned
FRENSIE_UNIT_TEST( AdjointElectronMaterial, getMacroscopicAbsorptionCrossSection )
{
double cross_section = material->getMacroscopicAbsorptionCrossSection( 1e-5 );
FRENSIE_CHECK_EQUAL( cross_section, 0.0 );
cross_section = material->getMacroscopicAbsorptionCrossSection( 1e-3 );
FRENSIE_CHECK_EQUAL( cross_section, 0.0 );
cross_section = material->getMacroscopicAbsorptionCrossSection( 20.0 );
FRENSIE_CHECK_EQUAL( cross_section, 0.0 );
}
//---------------------------------------------------------------------------//
// Check that the survival probability can be returned
FRENSIE_UNIT_TEST( AdjointElectronMaterial, getSurvivalProbability )
{
double survival_prob = material->getSurvivalProbability( 1e-5 );
FRENSIE_CHECK_FLOATING_EQUALITY( survival_prob, 1.0, 1e-12 );
survival_prob = material->getSurvivalProbability( 20.0 );
FRENSIE_CHECK_FLOATING_EQUALITY( survival_prob, 1.0, 1e-12 );
}
//---------------------------------------------------------------------------//
// Check that the macroscopic cross section for a specific reaction can be ret
FRENSIE_UNIT_TEST( AdjointElectronMaterial, getMacroscopicReactionCrossSection )
{
double cross_section;
MonteCarlo::AdjointElectroatomicReactionType reaction;
// Test that the atomic excitation cross section can be returned
reaction = MonteCarlo::ATOMIC_EXCITATION_ADJOINT_ELECTROATOMIC_REACTION;
cross_section = material->getMacroscopicReactionCrossSection( 1e-5, reaction );
FRENSIE_CHECK_FLOATING_EQUALITY( cross_section, 6.124055828282346576e+07*num_density, 1e-12 );
cross_section = material->getMacroscopicReactionCrossSection( 1e-3, reaction );
FRENSIE_CHECK_FLOATING_EQUALITY( cross_section, 1.050254326707092859e+07*num_density, 1e-12 );
cross_section = material->getMacroscopicReactionCrossSection( 20.0, reaction );
FRENSIE_CHECK_FLOATING_EQUALITY( cross_section, 8.182929983612992510e+04*num_density, 1e-12 );
// Test that the bremsstrahlung cross section can be returned
reaction = MonteCarlo::BREMSSTRAHLUNG_ADJOINT_ELECTROATOMIC_REACTION;
cross_section = material->getMacroscopicReactionCrossSection( 1e-5, reaction );
FRENSIE_CHECK_FLOATING_EQUALITY( cross_section, 4.422553386152458188e+01*num_density, 1e-12 );
cross_section = material->getMacroscopicReactionCrossSection( 1e-3, reaction );
FRENSIE_CHECK_FLOATING_EQUALITY( cross_section, 1.569786837648857869e+01*num_density, 1e-12 );
cross_section = material->getMacroscopicReactionCrossSection( 20.0, reaction );
FRENSIE_CHECK_FLOATING_EQUALITY( cross_section, 1.303534746154091928e-01*num_density, 1e-12 );
// Test that the coupled elastic cross section can be returned
reaction = MonteCarlo::COUPLED_ELASTIC_ADJOINT_ELECTROATOMIC_REACTION;
cross_section = material->getMacroscopicReactionCrossSection( 1e-5, reaction );
FRENSIE_CHECK_FLOATING_EQUALITY( cross_section, 2.74896e+08*num_density, 1e-12 );
cross_section = material->getMacroscopicReactionCrossSection( 1e-3, reaction );
FRENSIE_CHECK_FLOATING_EQUALITY( cross_section, 2.804290802376420237e+06*num_density, 1e-12 );
cross_section = material->getMacroscopicReactionCrossSection( 20.0, reaction );
FRENSIE_CHECK_FLOATING_EQUALITY( cross_section, 1.3022122514987041e+04*num_density, 1e-12 );
// Test that the decoupled elastic cross section can be returned
reaction = MonteCarlo::DECOUPLED_ELASTIC_ADJOINT_ELECTROATOMIC_REACTION;
cross_section = material->getMacroscopicReactionCrossSection( 1e-5, reaction );
FRENSIE_CHECK_EQUAL( cross_section, 0.0 );
cross_section = material->getMacroscopicReactionCrossSection( 20.0, reaction );
FRENSIE_CHECK_EQUAL( cross_section, 0.0 );
// Test that there is no hybrid elastic cross section
reaction = MonteCarlo::HYBRID_ELASTIC_ADJOINT_ELECTROATOMIC_REACTION;
cross_section = material->getMacroscopicReactionCrossSection( 1e-5, reaction );
FRENSIE_CHECK_EQUAL( cross_section, 0.0 );
cross_section = material->getMacroscopicReactionCrossSection( 20.0, reaction );
FRENSIE_CHECK_EQUAL( cross_section, 0.0 );
// Test that there is no total electroionization
reaction = MonteCarlo::TOTAL_ELECTROIONIZATION_ADJOINT_ELECTROATOMIC_REACTION;
cross_section = material->getMacroscopicReactionCrossSection( 1e-5, reaction );
FRENSIE_CHECK_EQUAL( cross_section, 0.0 );
cross_section = material->getMacroscopicReactionCrossSection( 20.0, reaction );
FRENSIE_CHECK_EQUAL( cross_section, 0.0 );
// Test that the K subshell electroionization cross section can be returned
reaction = MonteCarlo::K_SUBSHELL_ELECTROIONIZATION_ADJOINT_ELECTROATOMIC_REACTION;
cross_section = material->getMacroscopicReactionCrossSection( 1e-5, reaction );
FRENSIE_CHECK_FLOATING_EQUALITY( cross_section, 4.247114594404132843e+10*num_density, 1e-12 );
cross_section = material->getMacroscopicReactionCrossSection( 1e-3, reaction );
FRENSIE_CHECK_FLOATING_EQUALITY( cross_section, 3.278366089962531999e+07*num_density, 1e-12 );
cross_section = material->getMacroscopicReactionCrossSection( 20.0, reaction );
FRENSIE_CHECK_FLOATING_EQUALITY( cross_section, 3.130506131885223567e+03*num_density, 1e-12 );
// Test that the L1 subshell electroionization cross section can be returned
reaction = MonteCarlo::L1_SUBSHELL_ELECTROIONIZATION_ADJOINT_ELECTROATOMIC_REACTION;
cross_section = material->getMacroscopicReactionCrossSection( 1e-5, reaction );
FRENSIE_CHECK_EQUAL( cross_section, 0.0 );
cross_section = material->getMacroscopicReactionCrossSection( 1e-3, reaction );
FRENSIE_CHECK_EQUAL( cross_section, 0.0 );
cross_section = material->getMacroscopicReactionCrossSection( 20.0, reaction );
FRENSIE_CHECK_EQUAL( cross_section, 0.0 );
}
//---------------------------------------------------------------------------//
// Check that the absorption reaction types can be returned
FRENSIE_UNIT_TEST( AdjointElectronMaterial, getAbsorptionReactionTypes )
{
MonteCarlo::AdjointElectronMaterial::ReactionEnumTypeSet reaction_types;
material->getAbsorptionReactionTypes( reaction_types );
FRENSIE_CHECK_EQUAL( reaction_types.size(), 0 );
}
//---------------------------------------------------------------------------//
// Check that the scattering reaction types can be returned
FRENSIE_UNIT_TEST( AdjointElectronMaterial, getScatteringReactionTypes )
{
MonteCarlo::AdjointElectronMaterial::ReactionEnumTypeSet reaction_types;
material->getScatteringReactionTypes( reaction_types );
FRENSIE_CHECK_EQUAL( reaction_types.size(), 4 );
FRENSIE_CHECK( reaction_types.count( MonteCarlo::COUPLED_ELASTIC_ADJOINT_ELECTROATOMIC_REACTION ) );
FRENSIE_CHECK( reaction_types.count( MonteCarlo::BREMSSTRAHLUNG_ADJOINT_ELECTROATOMIC_REACTION ) );
FRENSIE_CHECK( reaction_types.count( MonteCarlo::ATOMIC_EXCITATION_ADJOINT_ELECTROATOMIC_REACTION ) );
FRENSIE_CHECK( reaction_types.count( MonteCarlo::K_SUBSHELL_ELECTROIONIZATION_ADJOINT_ELECTROATOMIC_REACTION ) );
}
//---------------------------------------------------------------------------//
// Check that the misc reaction types can be returned
FRENSIE_UNIT_TEST( AdjointElectronMaterial, getMiscReactionTypes )
{
MonteCarlo::AdjointElectronMaterial::ReactionEnumTypeSet reaction_types;
material->getMiscReactionTypes( reaction_types );
FRENSIE_CHECK_EQUAL( reaction_types.size(), 0 );
}
//---------------------------------------------------------------------------//
// Check that the reaction types can be returned
FRENSIE_UNIT_TEST( AdjointElectronMaterial, getReactionTypes )
{
MonteCarlo::AdjointElectronMaterial::ReactionEnumTypeSet reaction_types;
material->getReactionTypes( reaction_types );
FRENSIE_CHECK_EQUAL( reaction_types.size(), 5 );
FRENSIE_CHECK( reaction_types.count( MonteCarlo::TOTAL_ADJOINT_ELECTROATOMIC_REACTION ) );
FRENSIE_CHECK( reaction_types.count( MonteCarlo::COUPLED_ELASTIC_ADJOINT_ELECTROATOMIC_REACTION ) );
FRENSIE_CHECK( reaction_types.count( MonteCarlo::BREMSSTRAHLUNG_ADJOINT_ELECTROATOMIC_REACTION ) );
FRENSIE_CHECK( reaction_types.count( MonteCarlo::ATOMIC_EXCITATION_ADJOINT_ELECTROATOMIC_REACTION ) );
FRENSIE_CHECK( reaction_types.count( MonteCarlo::K_SUBSHELL_ELECTROIONIZATION_ADJOINT_ELECTROATOMIC_REACTION ) );
}
//---------------------------------------------------------------------------//
// Check that a adjoint electron can collide with the material
//! \details This unit test is dependent on the version of boost being used.
FRENSIE_UNIT_TEST( AdjointElectronMaterial, collideAnalogue )
{
// Test that the Doppler data is present
MonteCarlo::ParticleBank bank;
MonteCarlo::AdjointElectronState electron( 0 );
electron.setEnergy( 1.0e-3 );
electron.setDirection( 0.0, 0.0, 1.0 );
// Set up the random number stream
std::vector<double> fake_stream( 4 );
fake_stream[0] = 0.5; // select the H atom
fake_stream[1] = 1.0-1e-15; // select elastic scattering
fake_stream[2] = 0.0; // sample cutoff distribution
fake_stream[3] = 0.0; // sample mu = -1.0
Utility::RandomNumberGenerator::setFakeStream( fake_stream );
material->collideAnalogue( electron, bank );
FRENSIE_CHECK_EQUAL( electron.getEnergy(), 1e-3 );
FRENSIE_CHECK_FLOATING_EQUALITY( electron.getZDirection(), -1.0, 1e-12 );
FRENSIE_CHECK_EQUAL( electron.getWeight(), 1.0 );
Utility::RandomNumberGenerator::unsetFakeStream();
}
//---------------------------------------------------------------------------//
// Check that a adjoint electron can collide with the material and survival bias
//! \details This unit test is dependent on the version of boost being used.
FRENSIE_UNIT_TEST( AdjointElectronMaterial, collideSurvivalBias )
{
MonteCarlo::ParticleBank bank;
MonteCarlo::AdjointElectronState electron( 0 );
electron.setEnergy( 1e-3 );
electron.setDirection( 0.0, 0.0, 1.0 );
// Set up the random number stream
std::vector<double> fake_stream( 4 );
fake_stream[0] = 0.5; // select the H atom
fake_stream[1] = 1.0-1e-15; // select elastic scattering
fake_stream[2] = 1.0-1e-15; // sample cutoff distribution
fake_stream[3] = 1.0-1e-15; // sample mu = 0.999999
Utility::RandomNumberGenerator::setFakeStream( fake_stream );
material->collideSurvivalBias( electron, bank );
FRENSIE_CHECK_EQUAL( electron.getEnergy(), 1e-3 );
FRENSIE_CHECK_FLOATING_EQUALITY( electron.getZDirection(), 0.999999, 1e-12 );
FRENSIE_CHECK_EQUAL( electron.getWeight(), 1.0 );
Utility::RandomNumberGenerator::unsetFakeStream();
}
//---------------------------------------------------------------------------//
// Custom setup
//---------------------------------------------------------------------------//
FRENSIE_CUSTOM_UNIT_TEST_SETUP_BEGIN();
std::string test_scattering_center_database_name;
FRENSIE_CUSTOM_UNIT_TEST_COMMAND_LINE_OPTIONS()
{
ADD_STANDARD_OPTION_AND_ASSIGN_VALUE( "test_database",
test_scattering_center_database_name, "",
"Test scattering center database name "
"with path" );
}
FRENSIE_CUSTOM_UNIT_TEST_INIT()
{
{
// Determine the database directory
boost::filesystem::path database_path =
test_scattering_center_database_name;
boost::filesystem::path data_directory = database_path.parent_path();
// Load the database
const Data::ScatteringCenterPropertiesDatabase database( database_path );
const Data::AtomProperties& h_properties =
database.getAtomProperties( Data::H_ATOM );
// Set the scattering center definitions
MonteCarlo::ScatteringCenterDefinitionDatabase atom_definitions;
MonteCarlo::ScatteringCenterDefinition& h_definition =
atom_definitions.createDefinition( "H-Native", Data::H_ATOM );
h_definition.setAdjointElectroatomicDataProperties(
h_properties.getSharedAdjointElectroatomicDataProperties(
Data::AdjointElectroatomicDataProperties::Native_EPR_FILE, 0 ) );
MonteCarlo::AdjointElectroatomFactory::ScatteringCenterNameSet atom_aliases;
atom_aliases.insert( "H-Native" );
double upper_cutoff_angle_cosine = 1.0;
unsigned hash_grid_bins = 100;
MonteCarlo::SimulationProperties properties;
std::vector<double> user_critical_line_energies( 1 );
user_critical_line_energies[0] = 20.0;
properties.setCriticalAdjointElectronLineEnergies( user_critical_line_energies );
properties.setAdjointBremsstrahlungAngularDistributionFunction(
MonteCarlo::DIPOLE_DISTRIBUTION );
properties.setAdjointElasticCutoffAngleCosine( 1.0 );
properties.setNumberOfAdjointElectronHashGridBins( 100 );
properties.setAdjointElectronEvaluationTolerance( 1e-7 );
// Create the factories
MonteCarlo::AdjointElectroatomFactory factory( data_directory,
atom_aliases,
atom_definitions,
properties,
true );
MonteCarlo::AdjointElectroatomFactory::AdjointElectroatomNameMap atom_map;
factory.createAdjointElectroatomMap( atom_map );
// Assign the atom fractions and names
std::vector<double> atom_fractions( 1 );
std::vector<std::string> atom_names( 1 );
atom_fractions[0] = -1.0; // weight fraction
atom_names[0] = "H-Native";
num_density = 0.59749372094791031174;
// Create the test material
material.reset( new MonteCarlo::AdjointElectronMaterial( 0,
-1.0,
atom_map,
atom_fractions,
atom_names ) );
}
// Initialize the random number generator
Utility::RandomNumberGenerator::createStreams();
}
FRENSIE_CUSTOM_UNIT_TEST_SETUP_END();
//---------------------------------------------------------------------------//
// end tstAdjointElectronMaterial.cpp
//---------------------------------------------------------------------------//
|
2755e84081be53d9ab9cd4e2870cfb58333465c8 | 6613336ad4075de0a72d8c0465f6e61e804df1ff | /2602背包.cpp | 0f8bdc4574e8164095fc5471850231b02104cd40 | [] | no_license | cordercorder/HDUOJ | 9e43939973862c3bfd472ec4886a836749f0fdfc | f2ac49dc026dcb1aedd7459640b828edad7cbaf8 | refs/heads/master | 2020-03-27T04:22:02.049610 | 2018-08-24T02:41:48 | 2018-08-24T02:41:48 | 145,933,400 | 14 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 1,210 | cpp | 2602背包.cpp | #include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<map>
#include<deque>
#include<limits.h>
#include<bitset>
#include<ctime>
#define deb(x) cout<<"#---"<<#x<<"=="<<x<<endl
//#define DEBUG
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=1e3+10;
int t;
int n,v;
int w[maxn],val[maxn];
bool path[maxn][maxn];
vector<int> p;
int dp[maxn];
void solve(){
memset(dp,0,sizeof(dp));
for(int i=1;i<=n;i++){
for(int j=v;j>=w[i];j--){
if(dp[j]<=dp[j-w[i]]+val[i]){
path[i][j]=1;
dp[j]=dp[j-w[i]]+val[i];
}
}
}
printf("%d\n",dp[v]);
#ifdef DEBUG
for(int i=1;i<=n;i++){
for(int j=0;j<=v;j++){
cout<<path[i][j]<<" ";
}
printf("\n");
}
int i=n,j=v;
while(i>0&&j>=0){
if(path[i][j]){
j-=w[i];
p.push_back(i);
}
i--;
}
for(int i=0;i<(int)p.size();i++){
printf("%d ",p[i]);
}
#endif
}
int main(void){
scanf("%d",&t);
while(t--){
scanf("%d %d",&n,&v);
for(int i=1;i<=n;i++){
scanf("%d",&val[i]);
}
for(int i=1;i<=n;i++){
scanf("%d",&w[i]);
}
solve();
}
return 0;
}
|
6af8340a6e9f796e648d842a9351aa497f12f5b2 | 15987bb296410cd24c7626a6fc9a8218d85fca33 | /Graph Algorithms/tsort.cpp | 052c0dcf7b9878af3ae5105d090f4989bf453845 | [] | no_license | ElProfesor18/Competitive-Snippets | f2a77aa49a02c71fd4b4ad7958488201041c2117 | b18354e2cff9e58dc1c7bbb1d724b90cea83fcc9 | refs/heads/master | 2022-11-13T16:50:52.279784 | 2020-06-27T19:04:40 | 2020-06-27T19:04:40 | 273,887,777 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 586 | cpp | tsort.cpp | vector <lli> t;
void topologicalSortUtil(lli u, bool visited[], stack <lli> &st)
{
visited[u]=true;
for(auto it : adj[u])
{
if(!visited[it])
topologicalSortUtil(it, visited, st);
}
st.push(u);
}
void topologicalSort()
{
bool visited[V];
forz(i,V) visited[i]=false;
stack <lli> st;
forz(i,V)
{
if(!visited[i])
topologicalSortUtil(i, visited, st);
}
while(!st.empty())
{
// cout<<st.top()<<" ";
t.pb(st.top());
st.pop();
}
cout<<endl;
}
|
2590fcb956145d0cc51f2016c81df91eecb949a3 | 688e1615b6ea772f47d0222c7c16634b3eaabc89 | /_SHADERS/basic/basic_SHADER_GLOBALS.cpp | 4ea98452285de1c42f7d5db2f7ccdb3f4702bb79 | [] | no_license | marcclintdion/o1 | 42738ae92a23db4ec5f00bf620d1564ae74528fa | 14020c976dc0d25e04ea37de72e492ed1f2e3862 | refs/heads/master | 2020-04-06T07:08:30.152652 | 2016-08-04T02:18:46 | 2016-08-04T02:18:46 | 63,638,352 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,623 | cpp | basic_SHADER_GLOBALS.cpp | //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
unsigned char *vertexSource_basic;
unsigned char *fragmentSource_basic;
//=========================================================
var basic_LIGHT0_POS[] = { -17.612043, 12.247660, 55.905807 , 0.0};
var basic_LIGHT1_POS[] = { 3.167998, -15.363427, 20.949535, 0.0};
int basic_LIGHT1_DIRECTION[] = { 1, 1, 1};
//=========================================================================
var f_0_basic = 0.918402;
var f_1_basic = 1.0;
//=================================================
GLuint basic_SHADER_VERTEX;
GLuint basic_SHADER_FRAGMENT;
GLuint basic_SHADER;
//-------------------------------------------------
GLuint UNIFORM_LIGHT0_POS_basic;
GLuint UNIFORM_movingGlossyLight_POS_basic;
//-----
GLuint UNIFORM_f_0_basic;
GLuint UNIFORM_f_1_basic;
//-------------------------------------------------
GLuint UNIFORM_PROJECTION_MATRIX_basic;
GLuint UNIFORM_invertViewMatrix_basic;
GLuint UNIFORM_invertModelMatrix_basic;
//-------------------------------------------------
GLuint UNIFORM_TEX_COLOR_basic;
GLuint UNIFORM_TEX_DOT3_basic;
//shadow
GLuint UNIFORM_TEX_MASK0_basic;
|
7556cea30daa7d755da5aa3a5af087c90731140f | 0f2b08b31fab269c77d4b14240b8746a3ba17d5e | /onnxruntime/test/platform/env_test.cc | e0bffed8c4c175bb7310b6e84c80084cad8c48fd | [
"MIT"
] | permissive | microsoft/onnxruntime | f75aa499496f4d0a07ab68ffa589d06f83b7db1d | 5e747071be882efd6b54d7a7421042e68dcd6aff | refs/heads/main | 2023-09-04T03:14:50.888927 | 2023-09-02T07:16:28 | 2023-09-02T07:16:28 | 156,939,672 | 9,912 | 2,451 | MIT | 2023-09-14T21:22:46 | 2018-11-10T02:22:53 | C++ | UTF-8 | C++ | false | false | 936 | cc | env_test.cc | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include "core/platform/env.h"
#include <fstream>
#include "gtest/gtest.h"
#include "core/common/path_string.h"
#include "test/util/include/asserts.h"
namespace onnxruntime {
namespace test {
TEST(PlatformEnvTest, DirectoryCreationAndDeletion) {
const auto& env = Env::Default();
const PathString root_dir = ORT_TSTR("tmp_platform_env_test_dir");
const PathString sub_dir = root_dir + ORT_TSTR("/some/test/directory");
ASSERT_FALSE(env.FolderExists(root_dir));
ASSERT_STATUS_OK(env.CreateFolder(sub_dir));
ASSERT_TRUE(env.FolderExists(sub_dir));
// create a file in the subdirectory
{
std::ofstream outfile{sub_dir + ORT_TSTR("/file")};
outfile << "hello!";
}
ASSERT_STATUS_OK(env.DeleteFolder(root_dir));
ASSERT_FALSE(env.FolderExists(root_dir));
}
} // namespace test
} // namespace onnxruntime
|
7bc79ea64862511e1d68ea5d138ea25753dc0840 | d12d1bc01060e1194c3504fc6610d97a5f1cdd89 | /mainwindow.h | 0110b17f1e5e4615edba2e6df908c03b7177ac25 | [] | no_license | liangyiqiu/car_parking_console | 502cce28997ac70d9abbee6653ef94c8c2001aca | c6408b59ee88f5dcb41b949b26a53db0cd42eb5f | refs/heads/master | 2020-05-29T11:31:18.823003 | 2019-05-31T00:59:34 | 2019-05-31T00:59:34 | 189,119,885 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,347 | h | mainwindow.h | #ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "setwindow.h"
#include "parkwindow.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
private slots:
void on_pbtlogout_clicked();
void on_pbtset_clicked();
void receiveData();//接收子窗口信号的槽函数
void fun_register();//创建注册页面的函数
void fun_about();//显示关于信息的函数
void fun_init();//创建初始化停车场页面的函数
void fun_useredit();//创建修改用户名密码页面的函数
void on_pbtpark_clicked();
void on_pbtleave_clicked();
void on_pbtsearch_clicked();
void on_pbtbook_clicked();
private:
Ui::MainWindow *ui;
public:
//创建以下变量用于显示和子窗口调用
int level=0;//停车场等级
float feebig=0;//大车收费
float feesmall=0;//小车收费
int total=0;//总停车位数量
int book=0;//预定车位数量
int empty=0;//空车位数量
public:
void refresh(void);//刷新主窗口内容
};
class parklot{//关于停车场信息的类
public:
int level;
float feebig;
float feesmall;
int total=0;
int book=0;
int empty=0;
};
#endif // MAINWINDOW_H
|
324fef256a3c104ce4ab213c27ad9e2c55fab74b | fb227e3635b5c06e49bad48928f7b6d3254c4dca | /codeforces/601div2/e2.cpp | a46dfab746665c2ef806954ecc4bc9aa9522e711 | [] | no_license | BryanValeriano/marathon | 5be2ab354e49187c865f0296f7dfb5ab3c3d6c9b | 8dadfad7d1a6822f61ba5ed4a06e998541515634 | refs/heads/master | 2022-09-11T00:06:14.982588 | 2022-09-03T17:01:30 | 2022-09-03T17:01:30 | 141,581,750 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,543 | cpp | e2.cpp | #include <bits/stdc++.h>
using namespace std;
#define fr(i,n) _back
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define fi first
#define se second
#define endl '\n'
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
const ll INF = 1e18;
const double PI = acos(-1.0);
const int T = 1e5 + 3;
vector<int> dvs;
ll v[T];
int n;
ll tent(int sz) {
vii tmp;
ll t = 0;
int mid = 0;
ll ans = 0;
for(int i = 1; i <= n; i++) {
if(v[i]) {
if(t + v[i] <= sz) t += v[i], tmp.eb(i,v[i]);
else tmp.eb(i,sz-t), t = sz;
if(t >= sz/2 and mid == 0) mid = i;
}
while(t == sz) {
for(int j = 0; j < tmp.size(); j++)
ans += abs((ll)mid-(ll)tmp[j].fi)*tmp[j].se;
ii last = tmp.back();
tmp.clear();
t = 0;
mid = 0;
if(v[last.fi] - last.se) {
tmp.eb(last.fi, max(sz, v[last.fi] - last.se));
t = v[last.fi] - last.se;
if(t >= sz/2) mid = last.fi;
}
}
}
cout << sz << " " << ans << endl;
return ans;
}
int main() {
ios_base::sync_with_stdio(false);
cin >> n;
ll t = 0;
for(int i = 1; i <= n; i++) cin >> v[i], t += v[i];
for(ll i = 2; i*i <= t; i++)
if(!(t % i)) dvs.pb(i), dvs.pb(t/i);
dvs.pb(t);
ll ans = INF;
for(auto x : dvs) ans = min(ans, tent(x));
cout << (dvs.size() and ans != INF? ans : -1) << endl;
return 0;
}
|
f8a5e14a83b566997d3c8adc21bffbfd559555b4 | 66f5c4f812683d8db9ed5f499edfcf42b3b531fc | /String/print_Last_K_lines_FILE.cpp | 2f493d857f27cbfe3fb3194b00163ac3ae5eaf48 | [] | no_license | pango89/IDEONE | b5c00f846d31368757b38ed15b8c4094c313fd2b | 83332ff88300257b78cd115ac5f50e2601a4577b | refs/heads/master | 2020-05-31T23:26:30.843166 | 2014-08-15T04:52:56 | 2014-08-15T04:52:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 407 | cpp | print_Last_K_lines_FILE.cpp | #include<iostream>
void printLastKLines(char* filename,const int k)
{
ifstream file(filenmae);
string L[k];
int size=0;
while(file.good())
{
getline(file,L[size%k]);
size++;
}
int start=(size>k)?(size%k):0;
int count=(size>k)?k:size;
for(int i=0;i<count;i++)
{
cout<<L[start+i]<<"\n";
}
}
int main()
{
char* filename="Test.txt";
const int k=10;
printLastKLines(filename,k);
return 0;
}
|
89721cf72901b70804e0d3a3a4b0e33fdedb3679 | 4714badd5a49d40d0ccf14af4b0319baf103dea3 | /rootex/core/resource_loader.cpp | 2732d999aade0fcf73547e937014ad62f3954333 | [
"MIT"
] | permissive | sdslabs/Rootex | f17916063ab7875cb4f561847c1229b799a8c979 | 5fb00345b88b7e0e441c73e3f6d5f96455be269f | refs/heads/dev | 2023-09-02T00:54:17.768449 | 2023-08-24T22:34:05 | 2023-08-24T22:34:05 | 190,610,922 | 204 | 31 | NOASSERTION | 2023-09-03T19:13:12 | 2019-06-06T16:05:30 | C++ | UTF-8 | C++ | false | false | 10,166 | cpp | resource_loader.cpp | #include "resource_loader.h"
#include "app/application.h"
#include "os/thread.h"
bool IsFileSupported(const String& extension, ResourceFile::Type supportedFileType)
{
if (extension.empty())
{
return false;
}
String extensions(SupportedFiles.at(supportedFileType));
return extensions.find(extension) != String::npos;
}
Vector<const char*> GetPayloadTypes(const String& extension)
{
if (extension.empty())
{
return { "OTHER_PAYLOAD" };
}
if (m_PayloadTypes.find(extension) != m_PayloadTypes.end())
{
return m_PayloadTypes.at(extension);
}
else
{
return { "OTHER_PAYLOAD" };
}
}
Ref<ResourceFile> ResourceLoader::CreateResourceFile(const ResourceFile::Type& type, const String& path)
{
if (SupportedFiles.find(type) == SupportedFiles.end())
{
WARN("Tried to load an unsupported file type: " + path + " of type " + ResourceFile::s_TypeNames.at(type));
return nullptr;
}
switch (type)
{
case ResourceFile::Type::Text:
return CreateTextResourceFile(path);
case ResourceFile::Type::Audio:
return CreateAudioResourceFile(path);
case ResourceFile::Type::Font:
return CreateFontResourceFile(path);
case ResourceFile::Type::Image:
return CreateImageResourceFile(path);
case ResourceFile::Type::Lua:
return CreateLuaTextResourceFile(path);
case ResourceFile::Type::Model:
return CreateModelResourceFile(path);
case ResourceFile::Type::AnimatedModel:
return CreateAnimatedModelResourceFile(path);
case ResourceFile::Type::CollisionModel:
return CreateCollisionModelResourceFile(path);
case ResourceFile::Type::BasicMaterial:
return CreateBasicMaterialResourceFile(path);
case ResourceFile::Type::InstancingBasicMaterial:
return CreateInstancingBasicMaterialResourceFile(path);
case ResourceFile::Type::AnimatedBasicMaterial:
return CreateAnimatedBasicMaterialResourceFile(path);
case ResourceFile::Type::SkyMaterial:
return CreateSkyMaterialResourceFile(path);
case ResourceFile::Type::CustomMaterial:
return CreateCustomMaterialResourceFile(path);
case ResourceFile::Type::DecalMaterial:
return CreateDecalMaterialResourceFile(path);
// Not in use due to threading issues
case ResourceFile::Type::ParticleEffect:
default:
break;
}
return nullptr;
}
int ResourceLoader::Preload(ResourceCollection paths, Atomic<int>& progress)
{
progress = 0;
if (paths.empty())
{
PRINT("Asked to reload an empty list of files. Did nothing.");
return 0;
}
std::sort(paths.begin(), paths.end(), [](const Pair<ResourceFile::Type, String>& a, const Pair<ResourceFile::Type, String>& b) {
return (int)a.first < (int)b.first && a.second < b.second;
});
ResourceCollection empericalPaths = { paths.front() };
for (auto& incomingPath : paths)
{
if (empericalPaths.back() != incomingPath)
{
empericalPaths.emplace_back(incomingPath);
}
}
Vector<Ref<Task>> tasks;
for (auto& path : empericalPaths)
{
ResourceFile::Type type = path.first;
String pathString = path.second;
tasks.push_back(std::make_shared<Task>([=, &progress]() {
Ref<ResourceFile> res = CreateResourceFile(type, pathString);
Persist(res);
progress++;
}));
}
/// TODO: Fix the need for this dummy task (blocks the main thread if no resources are preloaded)
tasks.push_back(std::make_shared<Task>([]() {}));
progress++;
Application::GetSingleton()->getThreadPool().submit(tasks);
return tasks.size(); // One less for the dummy task
}
void ResourceLoader::Persist(Ref<ResourceFile> res)
{
s_PersistMutex.lock();
s_PersistentResources.push_back(res);
s_PersistMutex.unlock();
}
void ResourceLoader::ClearPersistentResources()
{
s_PersistentResources.clear();
}
void ResourceLoader::Initialize()
{
BasicMaterialResourceFile::Load();
AnimatedBasicMaterialResourceFile::Load();
InstancingBasicMaterialResourceFile::Load();
SkyMaterialResourceFile::Load();
CustomMaterialResourceFile::Load();
DecalMaterialResourceFile::Load();
}
void ResourceLoader::Destroy()
{
BasicMaterialResourceFile::Destroy();
AnimatedBasicMaterialResourceFile::Destroy();
InstancingBasicMaterialResourceFile::Destroy();
SkyMaterialResourceFile::Destroy();
CustomMaterialResourceFile::Destroy();
DecalMaterialResourceFile::Destroy();
}
const HashMap<ResourceFile::Type, Vector<Weak<ResourceFile>>>& ResourceLoader::GetResources()
{
return s_ResourcesDataFiles;
}
const char* ResourceLoader::GetCreatableExtension(ResourceFile::Type type)
{
if (CreatableFiles.find(type) != CreatableFiles.end())
{
return CreatableFiles.at(type);
}
return nullptr;
}
void ResourceLoader::SaveResources(ResourceFile::Type type)
{
for (auto& file : s_ResourcesDataFiles[type])
{
if (Ref<ResourceFile> resFile = file.lock())
{
if (resFile->getPath().string().substr(0, 6) != "rootex")
{
resFile->save();
}
}
}
}
void ResourceLoader::ClearDeadResources()
{
for (auto& [type, resources] : s_ResourcesDataFiles)
{
Vector<int> toRemove;
for (int i = 0; i < resources.size(); i++)
{
if (!resources[i].lock())
{
resources.erase(resources.begin() + i);
i--;
}
}
}
}
Ref<TextResourceFile> ResourceLoader::CreateTextResourceFile(const String& path)
{
return GetCachedResource<TextResourceFile>(ResourceFile::Type::Text, FilePath(path));
}
Ref<TextResourceFile> ResourceLoader::CreateNewTextResourceFile(const String& path)
{
if (!OS::IsExists(path))
{
OS::CreateFileName(path);
}
return CreateTextResourceFile(path);
}
Ref<BasicMaterialResourceFile> ResourceLoader::CreateNewBasicMaterialResourceFile(const String& path)
{
if (!OS::IsExists(path))
{
OS::CreateFileName(path);
}
return CreateBasicMaterialResourceFile(path);
}
Ref<AnimatedBasicMaterialResourceFile> ResourceLoader::CreateNewAnimatedBasicMaterialResourceFile(const String& path)
{
if (!OS::IsExists(path))
{
OS::CreateFileName(path);
}
return CreateAnimatedBasicMaterialResourceFile(path);
}
Ref<LuaTextResourceFile> ResourceLoader::CreateLuaTextResourceFile(const String& path)
{
return GetCachedResource<LuaTextResourceFile>(ResourceFile::Type::Lua, FilePath(path));
}
Ref<AudioResourceFile> ResourceLoader::CreateAudioResourceFile(const String& path)
{
return GetCachedResource<AudioResourceFile>(ResourceFile::Type::Audio, FilePath(path));
}
Ref<ModelResourceFile> ResourceLoader::CreateModelResourceFile(const String& path)
{
return GetCachedResource<ModelResourceFile>(ResourceFile::Type::Model, FilePath(path));
}
Ref<CollisionModelResourceFile> ResourceLoader::CreateCollisionModelResourceFile(const String& path)
{
return GetCachedResource<CollisionModelResourceFile>(ResourceFile::Type::CollisionModel, FilePath(path));
}
Ref<AnimatedModelResourceFile> ResourceLoader::CreateAnimatedModelResourceFile(const String& path)
{
return GetCachedResource<AnimatedModelResourceFile>(ResourceFile::Type::AnimatedModel, FilePath(path));
}
Ref<ImageResourceFile> ResourceLoader::CreateImageResourceFile(const String& path)
{
return GetCachedResource<ImageResourceFile>(ResourceFile::Type::Image, FilePath(path));
}
Ref<ImageCubeResourceFile> ResourceLoader::CreateImageCubeResourceFile(const String& path)
{
return GetCachedResource<ImageCubeResourceFile>(ResourceFile::Type::ImageCube, FilePath(path));
}
Ref<FontResourceFile> ResourceLoader::CreateFontResourceFile(const String& path)
{
return GetCachedResource<FontResourceFile>(ResourceFile::Type::Font, FilePath(path));
}
Ref<ParticleEffectResourceFile> ResourceLoader::CreateParticleEffectResourceFile(const String& path)
{
return GetCachedResource<ParticleEffectResourceFile>(ResourceFile::Type::ParticleEffect, FilePath(path));
}
Ref<MaterialResourceFile> ResourceLoader::CreateMaterialResourceFile(const String& path)
{
String extension;
int dotCount = 0;
for (int ch = path.size() - 1; ch >= 0; ch--)
{
if (path[ch] == '.')
{
dotCount++;
// When e.g. ".basic.rmat" has been found
if (dotCount == 2)
{
extension = path.substr(ch, path.size());
break;
}
}
}
if (extension.empty())
{
WARN("Couldn't deduce material type from file extension");
return nullptr;
}
if (IsFileSupported(extension, ResourceFile::Type::BasicMaterial))
{
return CreateBasicMaterialResourceFile(path);
}
if (IsFileSupported(extension, ResourceFile::Type::AnimatedBasicMaterial))
{
return CreateAnimatedBasicMaterialResourceFile(path);
}
if (IsFileSupported(extension, ResourceFile::Type::InstancingBasicMaterial))
{
return CreateInstancingBasicMaterialResourceFile(path);
}
if (IsFileSupported(extension, ResourceFile::Type::SkyMaterial))
{
return CreateSkyMaterialResourceFile(path);
}
if (IsFileSupported(extension, ResourceFile::Type::CustomMaterial))
{
return CreateCustomMaterialResourceFile(path);
}
if (IsFileSupported(extension, ResourceFile::Type::DecalMaterial))
{
return CreateDecalMaterialResourceFile(path);
}
return nullptr;
}
Ref<BasicMaterialResourceFile> ResourceLoader::CreateBasicMaterialResourceFile(const String& path)
{
return GetCachedResource<BasicMaterialResourceFile>(ResourceFile::Type::BasicMaterial, FilePath(path));
}
Ref<InstancingBasicMaterialResourceFile> ResourceLoader::CreateInstancingBasicMaterialResourceFile(const String& path)
{
return GetCachedResource<InstancingBasicMaterialResourceFile>(ResourceFile::Type::InstancingBasicMaterial, FilePath(path));
}
Ref<AnimatedBasicMaterialResourceFile> ResourceLoader::CreateAnimatedBasicMaterialResourceFile(const String& path)
{
return GetCachedResource<AnimatedBasicMaterialResourceFile>(ResourceFile::Type::AnimatedBasicMaterial, FilePath(path));
}
Ref<SkyMaterialResourceFile> ResourceLoader::CreateSkyMaterialResourceFile(const String& path)
{
return GetCachedResource<SkyMaterialResourceFile>(ResourceFile::Type::SkyMaterial, FilePath(path));
}
Ref<CustomMaterialResourceFile> ResourceLoader::CreateCustomMaterialResourceFile(const String& path)
{
return GetCachedResource<CustomMaterialResourceFile>(ResourceFile::Type::CustomMaterial, FilePath(path));
}
Ref<DecalMaterialResourceFile> ResourceLoader::CreateDecalMaterialResourceFile(const String& path)
{
return GetCachedResource<DecalMaterialResourceFile>(ResourceFile::Type::DecalMaterial, FilePath(path));
}
|
08f6af5fe0fc2aba17b6c8ab0b7771ff34d7b83c | 5a72c45ddef6d2cb5329a9f4731d377a7cef55ea | /C++/Uebung04/MainWindow.cpp | 3dea926e2391b2aeef466637230ce59276c66372 | [] | no_license | 00mark/projects-uni | df064dee5c9b017055d1d6cd3dce6c7a1471eea5 | d52a35975954f228b8e5ca30a409ca909f3deabb | refs/heads/main | 2023-09-04T20:58:07.323060 | 2021-11-22T18:52:40 | 2021-11-22T18:52:40 | 430,485,680 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,619 | cpp | MainWindow.cpp | /*
* MainWindow.cpp
*
* Created on: Nov. 04 2018
* Author: Thomas Wiemann
*
* Copyright (c) 2018 Thomas Wiemann.
* Restricted usage. Licensed for participants of the course "The C++ Programming Language" only.
* No unauthorized distribution.
*/
#include "MainWindow.hpp"
#include "Camera.hpp"
#include <iostream>
namespace asteroids
{
MainWindow::MainWindow(
std::string title,
std::string plyname, int w, int h) : m_model(plyname)
{
/* Initialize SDL's Video subsystem */
if (SDL_Init(SDL_INIT_VIDEO) < 0)
{
throw "Failed to init SDL";
}
/* Create our window */
m_window = SDL_CreateWindow(title.c_str(), SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED, w, h, SDL_WINDOW_OPENGL);
/* Check that everything worked out okay */
if (!m_window)
{
throw "Unable to create window";
}
/* Create our opengl context and attach it to our window */
m_context = SDL_GL_CreateContext(m_window);
/* Set our OpenGL version.
SDL_GL_CONTEXT_CORE gives us only the newer version, deprecated functions are disabled */
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK,
SDL_GL_CONTEXT_PROFILE_CORE);
/* 3.2 is part of the modern versions of OpenGL, but most video cards whould be able to run it */
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
/* Turn on double buffering with a 24bit Z buffer.
You may need to change this to 16 or 32 for your system */
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
/* This makes our buffer swap syncronized with the monitor's vertical refresh */
SDL_GL_SetSwapInterval(1);
/* Init GLEW */
#ifndef __APPLE__
glewExperimental = GL_TRUE;
glewInit();
#endif
SDL_GL_SwapWindow(m_window);
/* Init OpenGL projection matrix */
glClearColor(0.0, 0.0, 0.0, 1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glViewport(0, 0, w, h);
gluPerspective(45, w * 1.0 / h, 1, 10000);
/* Ender model view mode */
glMatrixMode(GL_MODELVIEW);
}
void MainWindow::execute()
{
/* create initial positon vector and camera */
Vector vec(0, 0, 750);
Camera cam(vec, 0.05, 10);
bool loop = true;
while (loop)
{
glClear(GL_COLOR_BUFFER_BIT);
SDL_Event event;
while (SDL_PollEvent(&event))
{
switch(event.type)
{
/* handle exit */
case SDL_QUIT:
loop = false;
break;
case SDL_KEYDOWN:
/* handle movement inputs */
switch(event.key.keysym.sym)
{
case SDLK_w: cam.move(Camera::FORWARD); break;
case SDLK_s: cam.move(Camera::BACKWARD); break;
case SDLK_a: cam.move(Camera::LEFT); break;
case SDLK_d: cam.move(Camera::RIGHT); break;
case SDLK_j: cam.move(Camera::DOWN); break;
case SDLK_k: cam.move(Camera::UP); break;
case SDLK_h: cam.turn(Camera::LEFT); break;
case SDLK_l: cam.turn(Camera::RIGHT); break;
}
break;
default:
break;
}
cam.apply();
}
/* Render model */
m_model.render();
/* Bring up back buffer */
SDL_GL_SwapWindow(m_window);
}
}
MainWindow::~MainWindow()
{
/* Delete our OpengL context */
SDL_GL_DeleteContext(m_context);
/* Destroy our window */
SDL_DestroyWindow(m_window);
/* Shutdown SDL 2 */
SDL_Quit();
}
} // namespace asteroids
|
c9e13a9a6c5e1e3bb35b42bd17eca49e5bcee7ba | d657856ce51764c0ba70d49664b8d5a0c89b2f1b | /SepChain.cpp | ecab96efba2453269650f4c5e27aaec17748aaf3 | [] | no_license | Manzoor-ul-Haq/Search-Engine | ea71529b80d1df9e14068dc09ab145090975e967 | 6c2d1f502f5dbbdd9f18aaa9084e489af7da52e8 | refs/heads/master | 2023-02-10T19:45:35.792951 | 2021-01-04T15:00:34 | 2021-01-04T15:00:34 | 326,717,034 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 666 | cpp | SepChain.cpp | #include <iostream>
#include "SepChain.h"
using namespace std;
Chaining::Chaining()
{
}
Chaining::~Chaining()
{
}
int Chaining::Hashfunc(float rating)
{
return rating * 10;
}
void Chaining::insert(string id, float rating, int votes)
{
array[Hashfunc(rating)].addAtStart(id, rating, votes);
}
bool Chaining::search(float rating)
{
if (Hashfunc(rating) > 100)
return false;
else if (array[Hashfunc(rating)].isEmpty() == true)
return false;
return array[Hashfunc(rating)].find1(rating);
}
void Chaining::display(float rating)
{
if (Hashfunc(rating) < 101)
array[Hashfunc(rating)].display();
else
cerr << "Does not exit" << endl;
}
|
e4a55423cbe829cdee6afbf5f24f2e4993c13219 | ceecbb6c45c7cec0b4a80eba732a894701b0479f | /aes_1.cpp | 7a6e968f8f0ae90635479f8dc80639553d9515ec | [] | no_license | ritwik-deshpande/DES-and-AES | 76416c6b70ea86c7f40d971908f1e47498ec9702 | 843f7472ace326471fda223ca6d29606986ab654 | refs/heads/master | 2022-07-12T06:15:40.052701 | 2020-05-12T06:56:01 | 2020-05-12T06:56:01 | 263,254,620 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 18,415 | cpp | aes_1.cpp | #include<iostream>
#include <bits/stdc++.h>
using namespace std;
int sbox[16][16]{
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84,
0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8,
0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2,
0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73,
0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb,
0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,
0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,
0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 };
int rsbox[16][16] = {
0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb,
0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb,
0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e,
0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25,
0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92,
0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84,
0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06,
0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b,
0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73,
0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e,
0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b,
0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4,
0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f,
0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef,
0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61,
0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d };
string hex2bin(string s){
// hexadecimal to binary conversion
unordered_map<char, string> mp;
mp['0']= "0000";
mp['1']= "0001";
mp['2']= "0010";
mp['3']= "0011";
mp['4']= "0100";
mp['5']= "0101";
mp['6']= "0110";
mp['7']= "0111";
mp['8']= "1000";
mp['9']= "1001";
mp['A']= "1010";
mp['B']= "1011";
mp['C']= "1100";
mp['D']= "1101";
mp['E']= "1110";
mp['F']= "1111";
string bin="";
for(int i=0; i<s.size(); i++){
if(s[i]>=97)
s[i] = s[i] - 32;
bin+= mp[s[i]];
}
return bin;
}
string bin2hex(string s){
// binary to hexadecimal conversion
unordered_map<string, string> mp;
mp["0000"]= "0";
mp["0001"]= "1";
mp["0010"]= "2";
mp["0011"]= "3";
mp["0100"]= "4";
mp["0101"]= "5";
mp["0110"]= "6";
mp["0111"]= "7";
mp["1000"]= "8";
mp["1001"]= "9";
mp["1010"]= "A";
mp["1011"]= "B";
mp["1100"]= "C";
mp["1101"]= "D";
mp["1110"]= "E";
mp["1111"]= "F";
string hex="";
for(int i=0; i<s.length(); i+=4){
string ch="";
ch+= s[i];
ch+= s[i+1];
ch+= s[i+2];
ch+= s[i+3];
hex+= mp[ch];
}
return hex;
}
int bin2dec(string n)
{
string num = n;
int dec_value = 0;
// Initializing base value to 1, i.e 2^0
int base = 1;
int len = num.length();
for (int i = len - 1; i >= 0; i--) {
if (num[i] == '1')
dec_value += base;
base = base * 2;
}
return dec_value;
}
typedef struct WordNode
{
bitset<32> word_32;
} Word;
bitset<32> SubWord(bitset<32> input){
bitset<32> output;
string answer = "";
bitset<32> retval;
for (int i = 0; i < 32; i = i + 8)
{
/* code */
int row = bin2dec(bitset<4>(input.to_string(),i,4).to_string());
int col = bin2dec(bitset<4>(input.to_string(),i+4,4).to_string());
answer = answer + bitset<8>(sbox[row][col]).to_string();
}
return bitset<32>(answer);
}
bitset<32> invSubWord(bitset<32> input){
bitset<32> output;
string answer = "";
bitset<32> retval;
for (int i = 0; i < 32; i = i + 8)
{
/* code */
int row = bin2dec(bitset<4>(input.to_string(),i,4).to_string());
int col = bin2dec(bitset<4>(input.to_string(),i+4,4).to_string());
answer = answer + bitset<8>(rsbox[row][col]).to_string();
}
return bitset<32>(answer);
}
bitset<32> RotWord(bitset<32> input,string dir){
bitset<32> output;
if(dir == "left"){
string padding = "";
for (int i = 0; i < 24; ++i)
{
/* code */
padding = padding + "0";
}
bitset<32> wrapper((padding + input.to_string()),24,8);
//cout<<"Wrapper "<<bin2hex(wrapper.to_string())<<endl;
output = input<<8;
output = output^wrapper;
}
else{
string padding = "";
for (int i = 0; i < 24; ++i)
{
/* code */
padding = padding + "0";
}
string wrap_temp = "";
string inp_str = bin2hex(input.to_string());
wrap_temp = wrap_temp + inp_str[inp_str.size()-2] + inp_str[inp_str.size()-1];
wrap_temp = hex2bin(wrap_temp);
bitset<32> wrapper(( wrap_temp + padding));
//cout<<"Wrapper "<<bin2hex(wrapper.to_string())<<endl;
output = input>>8;
output = output^wrapper;
}
return output;
}
void KeyGeneration(vector<Word> &key_words,string cipherkey_128){
for(int i=0;i<4;i++){
string temp = "";
for (int j = 0; j < 8; ++j)
{
temp = temp + cipherkey_128[8*i + j];
}
//cout<<temp<<" The hex value is "<<hex2bin(temp)<<" "<<hex2bin(temp).size()<<endl;
key_words[i].word_32 = bitset<32>(hex2bin(temp));
}
string rcon_strings[] = {"01000000","02000000","04000000","08000000","10000000","20000000","40000000","80000000","1B000000","36000000"};
vector<bitset<32>> RCon(10);
for (int i = 0; i < 10; ++i)
{
RCon[i] = bitset<32>(hex2bin(rcon_strings[i]));
}
bitset<32> t;
for (int i = 4; i < 44; ++i)
{
/* code */
if(i%4 != 0){
key_words[i].word_32 = key_words[i-1].word_32^key_words[i-4].word_32;
}
else{
//cout<<"After Left Shift"<<bin2hex(RotWord(key_words[i-1].word_32).to_string())<<endl;
t = SubWord(RotWord(key_words[i-1].word_32,"left"))^RCon[(i/4) -1];
//cout<< "After Entire Process"<<bin2hex(t.to_string())<<endl;
key_words[i].word_32 = key_words[i-4].word_32 ^ t;
}
//cout<<"Round Key Generated"<<bin2hex(key_words[i].word_32.to_string())<<endl;
}
}
void displayState(vector<Word> state){
for (int i = 0; i < 4; ++i)
{
/* code */
cout<<bin2hex(state[i].word_32.to_string())<<" "<<endl;
}
cout<<endl;
}
void getRoundKey(vector<Word> &round_key,int round_number,vector<Word> key_words){
string round_key_text = "";
for (int i = 0; i < 4; ++i)
{
/* code */
round_key_text = round_key_text + bin2hex(key_words[round_number*4 + i].word_32.to_string());
}
//round_key_text = key_words[0].word_32.to_string() + key_words[8*j + 2*i].word_32.to_string() + key_words[8*j + 2*i].word_32.to_string() + key_words[8*j + 2*i].word_32.to_string()
// cout<<"Key for round "<<round_number<<endl;
// cout<<round_key_text<<endl;
for (int i = 0; i < 4; ++i)
{
/* code */
string temp = "";
for (int j = 0; j < 4; ++j)
{
temp = temp + round_key_text[8*j + 2*i]+ round_key_text[8*j + 1 + 2*i];
}
//cout<<temp<<endl;
round_key[i].word_32 = bitset<32>(hex2bin(temp));
}
}
void shiftRows(bitset<32> &input ,int number_of_shifts){
for (int i = 0; i < number_of_shifts; ++i)
{
/* code */
input = RotWord(input,"left");
}
}
void invshiftRows(bitset<32> &input ,int number_of_shifts){
for (int i = 0; i < number_of_shifts; ++i)
{
/* code */
input = RotWord(input,"right");
}
}
bitset<8> multiply(bitset<8> a,bitset<8> b){
bitset<8> modulo("00011011");
bitset<8> answer("00000000");
for (int i = 0; i < 8; ++i)
{
if(b[i] == 1){
answer = answer^a;
}
if(a[7] == 1){
a = a<<1;
a = a^modulo;
}
else{
a = a<<1;
}
}//cout<<answer<<endl;
return answer;
}
string mixColumns(string column){
vector<bitset<8>> t(4);
vector<bitset<8>> col(4);
string retval;
for (int i = 0; i < 4; ++i)
{
/* code */
string temp ="";
temp = temp + column[2*i] + column[2*i+1];
t[i] = bitset<8>(hex2bin(temp));
// cout<<temp<<endl;
// cout<<t[i]<<endl;
}
//cout<<multiply(bitset<8>("10011110"),bitset<8>("00100110"))<<endl;
col[0] = multiply(t[0],bitset<8>(0x02))^multiply(t[1],bitset<8>(0x03))^t[2]^t[3];
col[1] = multiply(t[1],bitset<8>(0x02))^multiply(t[2],bitset<8>(0x03))^t[0]^t[3];
col[2] = multiply(t[2],bitset<8>(0x02))^multiply(t[3],bitset<8>(0x03))^t[0]^t[1];
col[3] = multiply(t[3],bitset<8>(0x02))^multiply(t[0],bitset<8>(0x03))^t[1]^t[2];
for (int i = 0; i < 4; ++i)
{
//cout<<"Final Result is:"<<bin2hex(col[i].to_string())<<endl;
retval = retval + bin2hex(col[i].to_string());
}
// cout<<"Col 0 is"<<col<<endl;
// retval = retval + col.to_string();
return retval;
}
string invmixColumns(string column){
vector<bitset<8>> t(4);
vector<bitset<8>> col(4);
string retval;
for (int i = 0; i < 4; ++i)
{
/* code */
string temp ="";
temp = temp + column[2*i] + column[2*i+1];
t[i] = bitset<8>(hex2bin(temp));
// cout<<temp<<endl;
// cout<<t[i]<<endl;
}
//cout<<multiply(bitset<8>("10011110"),bitset<8>("00100110"))<<endl;
col[0] = multiply(t[0],bitset<8>(0x0e))^multiply(t[1],bitset<8>(0x0b))^multiply(t[2],bitset<8>(0x0d))^multiply(t[3],bitset<8>(0x09));
col[1] = multiply(t[1],bitset<8>(0x0e))^multiply(t[2],bitset<8>(0x0b))^multiply(t[3],bitset<8>(0x0d))^multiply(t[0],bitset<8>(0x09));
col[2] = multiply(t[2],bitset<8>(0x0e))^multiply(t[3],bitset<8>(0x0b))^multiply(t[0],bitset<8>(0x0d))^multiply(t[1],bitset<8>(0x09));
col[3] = multiply(t[3],bitset<8>(0x0e))^multiply(t[0],bitset<8>(0x0b))^multiply(t[1],bitset<8>(0x0d))^multiply(t[2],bitset<8>(0x09));
for (int i = 0; i < 4; ++i)
{
//cout<<"Final Result is:"<<bin2hex(col[i].to_string())<<endl;
retval = retval + bin2hex(col[i].to_string());
}
// cout<<"Col 0 is"<<col<<endl;
// retval = retval + col.to_string();
return retval;
}
void ApplyRoundKey(vector<Word> &state,int round_number,vector<Word> key_words){
//cout<<"Apply Round Key"<<endl;
vector<Word> round_key(4);
getRoundKey(round_key,round_number,key_words);
for (int i = 0; i < 4; ++i)
{
/* code */
state[i].word_32 = state[i].word_32^round_key[i].word_32;
}
}
string encrypt(string plaintext_128,vector<Word> key_words){
vector<Word> state(4);
for(int i=0;i<4;i++){
string temp = "";
for (int j = 0; j < 4; ++j)
{
temp = temp + plaintext_128[8*j + 2*i] + plaintext_128[8*j + 1 + 2*i];
}
//cout<<temp<<endl;
//cout<<temp<<" The hex value is "<<hex2bin(temp)<<" "<<hex2bin(temp).size()<<endl;
state[i].word_32 = bitset<32>(hex2bin(temp));
}
// cout<<"Initial State"<<endl;
// displayState(state);
ApplyRoundKey(state,0,key_words);
// cout<<"At the end of round 0"<<endl;
// displayState(state);
//Round 1
for(int round = 1;round <=9;round++){
for (int i = 0; i < 4; ++i)
{
/* code */
state[i].word_32 = SubWord(state[i].word_32);
}
//displayState(state);
for (int i = 0; i < 4; ++i)
{
/* code */
shiftRows(state[i].word_32,i);
}
//displayState(state);
vector<string> mixed_columns(4);
for (int i = 0; i < 4; ++i)
{
/* code */
string column = "";
string row;
for (int j = 0; j < 4; ++j)
{
/* code */
row = bin2hex(state[j].word_32.to_string());
column = column + row[2*i] + row[2*i+1];
}
//cout<<"Columns is:"<<column<<endl;
mixed_columns[i] = mixColumns(column);
}
for (int i = 0; i < 4; ++i) {
/* code */
// state[i].word_32 =
string temp = "";
for (int j = 0; j < 4; ++j) { /* code */
temp = temp + mixed_columns[j][2*i] + mixed_columns[j][2*i+1];
}
//cout<<"The row is"<<temp<<endl;
state[i].word_32 = bitset<32> (hex2bin(temp));
}
// cout<<" After mix columns "<<round<<endl;
// displayState(state);
ApplyRoundKey(state,round,key_words);
// cout<<"End of Round "<<round<<endl;
// displayState(state);
//
}
for (int i = 0; i < 4; ++i)
{
/* code */
state[i].word_32 = SubWord(state[i].word_32);
}
//displayState(state);
for (int i = 0; i < 4; ++i)
{
/* code */
shiftRows(state[i].word_32,i);
}
ApplyRoundKey(state,10,key_words);
// cout<<"End of Round 10 "<<endl;
// displayState(state);
string temp_answer = "";
string final_answer = "";
for (int i = 0; i < 4; ++i)
{
/* code */
temp_answer = temp_answer + bin2hex(state[i].word_32.to_string());
}
string t1,t2;
for (int i = 0; i < 4; ++i)
{
/* code */
for (int j = 0; j < 4; ++j)
{
/* code */
t1 = temp_answer[8*j + 2*i];
if(t1[0]>= 65 && t1[0]<97)
t1[0] = t1[0] + 32;
t2 = temp_answer[8*j + 2*i + 1];
if(t2[0]>= 65 && t2[0]<97)
t2[0] = t2[0] + 32;
string temp = t1+t2;
final_answer = final_answer + temp;
}
}
return final_answer;
}
string decrypt(string cipher_128,vector<Word> key_words){
vector<Word> state(4);
for(int i=0;i<4;i++){
string temp = "";
for (int j = 0; j < 4; ++j)
{
temp = temp + cipher_128[8*j + 2*i] + cipher_128[8*j + 1 + 2*i];
}
//cout<<temp<<endl;
//cout<<temp<<" The hex value is "<<hex2bin(temp)<<" "<<hex2bin(temp).size()<<endl;
state[i].word_32 = bitset<32>(hex2bin(temp));
}
// cout<<"Initial State"<<endl;
// displayState(state);
ApplyRoundKey(state,10,key_words);
// cout<<"At the end of round 0"<<endl;
// displayState(state);
//Round 1
for(int round = 9;round >0;round--){
for (int i = 0; i < 4; ++i)
{
/* code */
invshiftRows(state[i].word_32,i);
}
for (int i = 0; i < 4; ++i)
{
/* code */
state[i].word_32 = invSubWord(state[i].word_32);
}
//cout<<"Cancelled Round"<<round + 1<<endl;
// displayState(state);
ApplyRoundKey(state,round,key_words);
// cout<<"After row shifts"<<endl;
//displayState(state);
vector<string> mixed_columns(4);
for (int i = 0; i < 4; ++i)
{
/* code */
string column = "";
string row;
for (int j = 0; j < 4; ++j)
{
/* code */
row = bin2hex(state[j].word_32.to_string());
column = column + row[2*i] + row[2*i+1];
}
//cout<<"Columns is:"<<column<<endl;
mixed_columns[i] = invmixColumns(column);
}
for (int i = 0; i < 4; ++i) {
/* code */
// state[i].word_32 =
string temp = "";
for (int j = 0; j < 4; ++j) { /* code */
temp = temp + mixed_columns[j][2*i] + mixed_columns[j][2*i+1];
}
//cout<<"The row is"<<temp<<endl;
state[i].word_32 = bitset<32> (hex2bin(temp));
}
// cout<<" After mix columns "<<round<<endl;
// displayState(state);
}
for (int i = 0; i < 4; ++i)
{
/* code */
invshiftRows(state[i].word_32,i);
}
for (int i = 0; i < 4; ++i)
{
/* code */
state[i].word_32 = invSubWord(state[i].word_32);
}
//displayState(state);
ApplyRoundKey(state,0,key_words);
// cout<<"After round 10"<<endl;
// displayState(state);
string temp_answer = "";
string final_answer = "";
for (int i = 0; i < 4; ++i)
{
/* code */
temp_answer = temp_answer + bin2hex(state[i].word_32.to_string());
}
string t1,t2;
for (int i = 0; i < 4; ++i)
{
/* code */
for (int j = 0; j < 4; ++j)
{
/* code */
t1 = temp_answer[8*j + 2*i];
if(t1[0]>= 65 && t1[0]<97)
t1[0] = t1[0] + 32;
t2 = temp_answer[8*j + 2*i + 1];
if(t2[0]>= 65 && t2[0]<97)
t2[0] = t2[0] + 32;
string temp = t1+t2;
final_answer = final_answer + temp;
}
}
return final_answer;
}
string Slice(string plaintext,int start,int end){
string retval = "";
for(int i = start;i<end;i++){
retval = retval + plaintext[i];
}
return retval;
}
int main(){
string plaintext = "00112233445566778899aabbccddeeff1234";
string cipherkey_128 = "000102030405060708090a0b0c0d0e0f";
string ciphertext;
int pt_size;
int initial_size;
int blocks;
string pt_block;
string ct_block;
//string temp_plaintext;
vector<Word> key_words(44);
KeyGeneration(key_words,cipherkey_128);
// for (int i = 0; i < 44; ++i)
// {
// /* code */
// //cout<<"Key Word "<<i<<" "<<bin2hex(key_words[i].word_32.to_string())<<endl;
// }
blocks = ceil((float)plaintext.size()/(float)32);
pt_size = blocks*32;
initial_size = plaintext.size();
for(int i = 0;i<pt_size - initial_size;i++){
plaintext = plaintext +'0';
}
for(int i = 0;i<blocks;i++){
pt_block = Slice(plaintext,i*32,(i+1)*32);
// cout<<pt_block<<endl;
ciphertext = ciphertext + encrypt(pt_block,key_words);
//cout<<ciphertext<<endl;
}
cout<<ciphertext<<endl;
plaintext = "";
for(int i = 0;i<blocks;i++){
ct_block = Slice(ciphertext,i*32,(i+1)*32);
// cout<<pt_block<<endl;
plaintext =plaintext + decrypt(ct_block,key_words);
//cout<<ciphertext<<endl;
}
cout<<plaintext<<endl;
return 0;
} |
2f848dddc464862fed635b9a8d2e6ce9197981d1 | 5caec92184cab6df35d1225e4fcedfc3afbcc2df | /opengl1/Render.h | 0b3790717b7eb7b44e7232096434d28995c42dbf | [] | no_license | jmieses/opengl_2D_gui | ae40910b08d6123fb4deab4c46327b3d4cbe21da | 5d1232adf73f6d2b0d30c23668a52425657764a0 | refs/heads/master | 2023-03-20T18:25:59.601695 | 2021-03-04T05:17:03 | 2021-03-04T05:17:03 | 327,464,855 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 825 | h | Render.h | #pragma once
#ifndef RENDER_H
#define RENDER_H
#include "VertexArray.h"
#include "VertexBuffer.h"
#include "VertexBufferLayout.h"
#include "Shader.h"
#include "Curve.h"
#include <vector>
struct RenderObject {
VertexArray vertex_array;
VertexBuffer vertex_buffer;
VertexBufferLayout layout;
Shader shader;
};
class Render : public Curve{
public:
Render();
void Dynamic_Draw();
void Add_Control_Point();
void Remove_Control_Point();
bool show_decasteljau;
bool show_bspline;
bool show_nurbs;
bool update_control_points;
private:
RenderObject m_rdr_obj_ctrl_pts;
RenderObject m_rdr_obj_decasteljau;
RenderObject m_rdr_obj_bspline;
RenderObject m_rdr_obj_nurbs;
void Draw(RenderObject&, const std::vector<float>&);
void Update_Vertices(std::vector<float>&);
void Normal_Distribution(float *);
};
#endif |
67ad390117c5da9760f8e4d5a757536a1772b286 | f3eb4e0d39518b2831347effc8cd15c4ab81d86a | /printstarinmiddle.cpp | daf3b3467d338ef2347e4fa2973d706dacd57664 | [] | no_license | PRIYADHARSHINI1118/priyadharshini18 | 676d48bd8f062a55f281c9739c8b72373925df61 | e9edbbf6acebc19dccdd5426f8b3c68614f58792 | refs/heads/master | 2021-04-30T01:50:55.566615 | 2018-05-23T07:00:52 | 2018-05-23T07:00:52 | 121,491,461 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 404 | cpp | printstarinmiddle.cpp | #include <iostream>
using namespace std;
int main()
{
char s[100];
int i,e,count=0;
cout<<"enter the string";
cin>>s;
for(i=0;s[i]!=0;i++)
{
count++;
}
e=count/2;
if(count%2!=0)
{
s[e]='*';
for(i=0;s[i]!='\0';i++)
{
cout<<s[i];
}
}
else
{
s[e-1]='*';
for(i=0;s[i]!='\0';i++)
{
cout<<s[i];
}
}
return 0;
}
|
7ee3342b36830efa81a7c9fd86c32c9343f90046 | 6da5140e9595582c2ab10f3a7def25115912973c | /04/01.dialog/Demo.03/DlgFileBrowse.h | 0afa3ec4ade918afacff8c15b09134268e55718f | [] | no_license | s1040486/xiaohui | 6df6064bb0d1e858429375b45418e4f2d234d1a3 | 233b6dfbda130d021b8d91ae6a3736ecc0f9f936 | refs/heads/master | 2022-01-12T07:10:57.181009 | 2019-06-01T04:02:16 | 2019-06-01T04:02:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,050 | h | DlgFileBrowse.h | #if !defined(AFX_DLGFILEBROWSE_H__942D1242_B4AD_11D3_9CE3_E7C9978DB001__INCLUDED_)
#define AFX_DLGFILEBROWSE_H__942D1242_B4AD_11D3_9CE3_E7C9978DB001__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DlgFileBrowse.h : header file
//
class CThreadRunningDlg;
/////////////////////////////////////////////////////////////////////////////
// CDlgFileBrowse dialog
class CDlgFileBrowse : public CFileDialog
{
DECLARE_DYNAMIC(CDlgFileBrowse)
public:
CDlgFileBrowse(
CThreadRunningDlg& rThreadRunningDlg
);
protected:
//{{AFX_MSG(CDlgFileBrowse)
virtual BOOL OnInitDialog();
//}}AFX_MSG
afx_msg LPARAM OnInitFinished(WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP()
protected:
void OnInitDone();
BOOL OnFileNameOK();
void OnFolderChange();
private:
CThreadRunningDlg& m_rThreadRunningDlg;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DLGFILEBROWSE_H__942D1242_B4AD_11D3_9CE3_E7C9978DB001__INCLUDED_)
|
d2bf499659f64a564238cf8be0fb627fd22ed32f | b14c76104fb65ba4a9439ea3c9523709a90e1a5a | /source/Renderer/Renderer/Src/Pipeline/ColourBlendStateAttachment.cpp | c182f1e409ce576367cfbd594308ec477365fa38 | [
"MIT"
] | permissive | corefan/RendererLib | b8678550a523fdbef2017a6367b5446bee180014 | 4af2052e7556546d51c5c3692fdf7f19e10bd6b4 | refs/heads/master | 2021-04-26T23:00:54.659033 | 2018-03-03T21:46:39 | 2018-03-03T21:46:39 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,196 | cpp | ColourBlendStateAttachment.cpp | /*
This file belongs to RendererLib.
See LICENSE file in root folder.
*/
#include "Pipeline/ColourBlendStateAttachment.hpp"
namespace renderer
{
ColourBlendStateAttachment::ColourBlendStateAttachment( bool blendEnable
, BlendFactor srcColorBlendFactor
, BlendFactor dstColorBlendFactor
, BlendOp colorBlendOp
, BlendFactor srcAlphaBlendFactor
, BlendFactor dstAlphaBlendFactor
, BlendOp alphaBlendOp
, ColourComponentFlags colorWriteMask )
: m_blendEnable{ blendEnable }
, m_srcColorBlendFactor{ srcColorBlendFactor }
, m_dstColorBlendFactor{ dstColorBlendFactor }
, m_colorBlendOp{ colorBlendOp }
, m_srcAlphaBlendFactor{ srcAlphaBlendFactor }
, m_dstAlphaBlendFactor{ dstAlphaBlendFactor }
, m_alphaBlendOp{ alphaBlendOp }
, m_colorWriteMask{ colorWriteMask }
, m_hash
{ uint32_t(
( uint32_t( m_blendEnable ) << 31 )
| ( uint32_t( m_srcColorBlendFactor ) << 26 )
| ( uint32_t( m_dstColorBlendFactor ) << 21 )
| ( uint32_t( m_colorBlendOp ) << 18 )
| ( uint32_t( m_srcAlphaBlendFactor ) << 13 )
| ( uint32_t( m_dstAlphaBlendFactor ) << 8 )
| ( uint32_t( m_alphaBlendOp ) << 5 )
| ( uint32_t( m_colorWriteMask ) << 1 )
) }
{
}
}
|
403109c96fd524e7eaf5c39f2b501f6845ee4724 | 54f352a242a8ad6ff5516703e91da61e08d9a9e6 | /Source Codes/AtCoder/arc080/A/1914261.cpp | 1556acb898230b24b7b3fb2f662b4e5da8ca89e9 | [] | no_license | Kawser-nerd/CLCDSA | 5cbd8a4c3f65173e4e8e0d7ed845574c4770c3eb | aee32551795763b54acb26856ab239370cac4e75 | refs/heads/master | 2022-02-09T11:08:56.588303 | 2022-01-26T18:53:40 | 2022-01-26T18:53:40 | 211,783,197 | 23 | 9 | null | null | null | null | UTF-8 | C++ | false | false | 493 | cpp | 1914261.cpp | #include<iostream>
using namespace std;
int main ()
{
int n;
cin>>n;
if(n>=2&&n<=100000)
{
int a=0,b=0,m,t;
for(int i=0;i<n;i++)
{
cin>>t;
if(t<1&&t>1000000000)
goto loop;
if(t%2==0)
a++;
if(t%4==0)
b++;
}
m=a-b;
if(n<=2*b+m&&m!=0)
cout<<"Yes";
else if(n<=2*b+1&&m==0)
cout<<"Yes";
else
loop: cout<<"No";
}
cout<<endl;
return 0;
} |
2db52d21bc31dc028f66994734fdf86aef8b0483 | 2cdeca1b6090ae625a892cace8b0ad509d0d017a | /Core/Physics.h | dd26acacda6c703990587ed7dbfef4cfb5a542aa | [] | no_license | mth128/SolarSystem | fdb2e15224e71dca61f82c736bdd874ed2c8cb40 | ea2357fcbf131caf0591c0cbb6c584b60b20db28 | refs/heads/master | 2020-05-14T10:06:46.608796 | 2019-08-08T08:03:57 | 2019-08-08T08:03:57 | 181,754,938 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,040 | h | Physics.h | //Copyright Maarten 't Hart 2019
#pragma once
#include "Planet.h"
struct GravityAffectedObject
{
bool disposed;
Point3D* position;
Point3D* velocity;
int count;
GravityAffectedObject(Point3D*position, Point3D*velocity, int count);
Point3D& Position(int index);
Point3D& Velocity(int index);
double Speed();
//first calculate the velocity change by each gravity source, then move once.
void MoveByGravity(std::vector<Planet*>&gravitySources, double seconds = 1.);
//affecting the velocity. Does not move anything
void PullGravity(Planet*planet, double seconds = 1.);
//affecting the velocity. Does not move anything
Point3D PullGravity(const Point3D&gravityPosition, double surfaceGravity, double gravityRadius, double seconds, const Point3D&position);
void Move(double seconds);
};
double LocalGravity(double gravityDistanceSquared, double surfaceGravity, double gravityRadius = 1.);
double GravityAcceleration(double gravityDistanceSquared, double gravityAtSurface, double gravityRadius = 1., double seconds = 1.); |
5e9377d606e3d901e35388cf3219beefb0afaef5 | d34c52b0f0651153ecf774bc341d8b1205fe3e5d | /DirectX12_BaseSystem/src/core/dxgi.cpp | 9c116ae9cf5921e8b2aaf5e35e439d8b517876e1 | [] | no_license | rengooooooku/DirectX12-BaseSystem | f3a6dc7b41ea5f9954cd965526615a612517ef81 | 07981d6a26b10917e3e7d9a02611a700d94f4d48 | refs/heads/master | 2020-04-15T06:09:49.602995 | 2015-12-04T02:01:33 | 2015-12-04T02:01:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,756 | cpp | dxgi.cpp | #pragma comment( lib, "d3dcompiler.lib" )
#pragma comment( lib, "dxgi.lib" )
#include "d3d.h"
#include "dxgi.h"
#include <PlatformHelpers.h>
namespace dxgi
{
void ReleaseIUnknown(IUnknown* p)
{
p->Release();
}
std::shared_ptr<IDXGIFactory4> CreateFactory()
{
IDXGIFactory4* factory;
DirectX::ThrowIfFailed(CreateDXGIFactory1(IID_PPV_ARGS(&factory)));
return std::shared_ptr<IDXGIFactory4>(factory, ReleaseIUnknown);
}
std::shared_ptr<IDXGIAdapter3> CreateAdapter(IDXGIFactory4* factory)
{
IDXGIAdapter3* adapter;
DirectX::ThrowIfFailed(factory->EnumWarpAdapter(IID_PPV_ARGS(&adapter)));
return std::shared_ptr<IDXGIAdapter3>(adapter, ReleaseIUnknown);
}
std::shared_ptr<IDXGISwapChain3> CreateSwapChain(ID3D12CommandQueue * commandQueue, const HWND* hWnd, DXGI_SWAP_CHAIN_DESC* swapChainDesc)
{
ID3D12Device* device;
commandQueue->GetDevice(IID_PPV_ARGS(&device));
IDXGISwapChain* swapChain;
IDXGISwapChain3* swapChain3;
DXGI_SWAP_CHAIN_DESC defaultDesc = {};
if (!swapChainDesc)
{
defaultDesc.BufferCount = 2;
defaultDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
defaultDesc.BufferDesc.Width = 1200;
defaultDesc.BufferDesc.Height = 900;
defaultDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
defaultDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
defaultDesc.OutputWindow = *hWnd;
defaultDesc.SampleDesc.Count = 1;
defaultDesc.Windowed = TRUE;
swapChainDesc = &defaultDesc;
}
DirectX::ThrowIfFailed(CreateFactory()->CreateSwapChain(
commandQueue,
swapChainDesc,
&swapChain
));
swapChain->QueryInterface(IID_PPV_ARGS(&swapChain3));
swapChain->Release();
device->Release();
return std::shared_ptr<IDXGISwapChain3>(swapChain3, ReleaseIUnknown);
}
} |
43ae88de49b41311940f58a308967f6bb6dd1078 | 71d97eaa68615ab13e7a24771a067fc2d08cd86c | /widgets/NewKey.h | dfaf56dd10e2f96a2996dd60364a0160ee20b68c | [
"BSD-3-Clause"
] | permissive | 10100010meow/xca | 306dce014a45affa494e751920fef1591bcb3259 | 3379e3dbfed4f2e21a137d249dbf7254846cc4ff | refs/heads/master | 2021-04-28T17:04:55.612994 | 2014-09-03T15:01:19 | 2014-09-03T15:01:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 520 | h | NewKey.h | /* vi: set sw=4 ts=4:
*
* Copyright (C) 2001 - 2010 Christian Hohnstaedt.
*
* All rights reserved.
*/
#ifndef __NEWKEY_H
#define __NEWKEY_H
#include "ui_NewKey.h"
#include "lib/pkcs11_lib.h"
#include <QtCore/QStringList>
class NewKey: public QDialog, public Ui::NewKey
{
Q_OBJECT
public:
NewKey(QWidget *parent, QString name);
int getKeytype();
int getKeysize();
int getKeyCurve_nid();
slotid getKeyCardSlot();
bool isToken();
public slots:
void on_keyType_currentIndexChanged(int);
};
#endif
|
46b5a52664d0bcf81ae6c28af39c8676822948a1 | bdd9f3cdabe0c768641cf61855a6f24174735410 | /src/engine/client/application/TerrainEditor/src/win32/FormFilterDirection.cpp | 2f04b94f736091f0b1cdbe84c8bbfc5c41975330 | [] | no_license | SWG-Source/client-tools | 4452209136b376ab369b979e5c4a3464be28257b | 30ec3031184243154c3ba99cedffb2603d005343 | refs/heads/master | 2023-08-31T07:44:22.692402 | 2023-08-28T04:34:07 | 2023-08-28T04:34:07 | 159,086,319 | 15 | 47 | null | 2022-04-15T16:20:34 | 2018-11-25T23:57:31 | C++ | UTF-8 | C++ | false | false | 4,819 | cpp | FormFilterDirection.cpp | //
// FormFilterDirection.cpp
// asommers
//
// copyright 2001, sony online entertainment
//-------------------------------------------------------------------
#include "FirstTerrainEditor.h"
#include "FormFilterDirection.h"
#include "sharedTerrain/Filter.h"
//-------------------------------------------------------------------
IMPLEMENT_DYNCREATE(FormFilterDirection, FormLayerItem)
//-------------------------------------------------------------------
#pragma warning(push)
#pragma warning(disable:4355)
FormFilterDirection::FormFilterDirection() :
FormLayerItem(FormFilterDirection::IDD),
m_filter (0),
m_editFeatherDistance (this),
m_sliderFeatherDistance (),
//-- widgets
m_featherFunction (),
m_maximumAngleDegrees (true),
m_minimumAngleDegrees (true),
m_name ()
{
//{{AFX_DATA_INIT(FormFilterDirection)
m_name = _T("");
//}}AFX_DATA_INIT
}
#pragma warning(pop)
//-------------------------------------------------------------------
FormFilterDirection::~FormFilterDirection()
{
m_filter = 0;
}
//-------------------------------------------------------------------
void FormFilterDirection::DoDataExchange(CDataExchange* pDX)
{
FormLayerItem::DoDataExchange(pDX);
//{{AFX_DATA_MAP(FormFilterDirection)
DDX_Control(pDX, IDC_MINANGDEG, m_minimumAngleDegrees);
DDX_Control(pDX, IDC_MAXANGLEDEG, m_maximumAngleDegrees);
DDX_Control(pDX, IDC_SLIDER_FEATHERDISTANCE, m_sliderFeatherDistance);
DDX_Control(pDX, IDC_FEATHER_DISTANCE, m_editFeatherDistance);
DDX_Control(pDX, IDC_FEATHER_FUNCTION, m_featherFunction);
DDX_Text(pDX, IDC_NAME, m_name);
//}}AFX_DATA_MAP
}
//-------------------------------------------------------------------
//lint -save -e1924
BEGIN_MESSAGE_MAP(FormFilterDirection, PropertyView)
//{{AFX_MSG_MAP(FormFilterDirection)
ON_CBN_SELCHANGE(IDC_FEATHER_FUNCTION, OnSelchangeFeatherFunction)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//lint -restore
//-------------------------------------------------------------------
#ifdef _DEBUG
void FormFilterDirection::AssertValid() const
{
FormLayerItem::AssertValid();
}
void FormFilterDirection::Dump(CDumpContext& dc) const
{
FormLayerItem::Dump(dc);
}
#endif //_DEBUG
//-------------------------------------------------------------------
void FormFilterDirection::Initialize (PropertyView::ViewData* vd)
{
NOT_NULL (vd);
FormLayerItemViewData* flivd = dynamic_cast<FormLayerItemViewData*> (vd);
NOT_NULL (flivd);
m_filter = dynamic_cast<FilterDirection*> (flivd->item->layerItem);
NOT_NULL (m_filter);
}
//-------------------------------------------------------------------
void FormFilterDirection::OnInitialUpdate()
{
FormLayerItem::OnInitialUpdate();
NOT_NULL (m_filter);
m_name = m_filter->getName();
m_minimumAngleDegrees = convertRadiansToDegrees (m_filter->getMinimumAngle ());
m_maximumAngleDegrees = convertRadiansToDegrees (m_filter->getMaximumAngle ());
IGNORE_RETURN (m_featherFunction.SetCurSel (m_filter->getFeatherFunction ()));
m_editFeatherDistance.LinkSmartSliderCtrl (&m_sliderFeatherDistance);
m_editFeatherDistance.SetParams (0.0f, 1.0f, 20, "%1.5f");
IGNORE_RETURN (m_editFeatherDistance.SetValue (m_filter->getFeatherDistance ()));
IGNORE_RETURN (UpdateData (false));
m_initialized = true;
}
//-------------------------------------------------------------------
void FormFilterDirection::OnDestroy()
{
ApplyChanges ();
PropertyView::OnDestroy();
}
//-------------------------------------------------------------------
bool FormFilterDirection::HasChanged () const
{
return
(m_minimumAngleDegrees != convertRadiansToDegrees (m_filter->getMinimumAngle ())) ||
(m_maximumAngleDegrees != convertRadiansToDegrees (m_filter->getMaximumAngle ())) ||
(static_cast<TerrainGeneratorFeatherFunction> (m_featherFunction.GetCurSel ()) != m_filter->getFeatherFunction ()) ||
(m_editFeatherDistance.GetValueFloat () != m_filter->getFeatherDistance ());
}
//-------------------------------------------------------------------
void FormFilterDirection::ApplyChanges ()
{
if (!m_initialized)
return;
IGNORE_RETURN (UpdateData (true));
if (HasChanged ())
{
NOT_NULL (m_filter);
m_filter->setMinimumAngle (convertDegreesToRadians (m_minimumAngleDegrees));
m_filter->setMaximumAngle (convertDegreesToRadians (m_maximumAngleDegrees));
m_filter->setFeatherFunction (static_cast<TerrainGeneratorFeatherFunction> (m_featherFunction.GetCurSel ()));
m_filter->setFeatherDistance (m_editFeatherDistance.GetValueFloat ());
GetDocument ()->UpdateAllViews (this);
GetDocument ()->SetModifiedFlag ();
}
}
//-------------------------------------------------------------------
void FormFilterDirection::OnSelchangeFeatherFunction()
{
ApplyChanges ();
}
//-------------------------------------------------------------------
|
5be5924108ec018b477fc00c959ac5a88cc8d4f9 | ad4a16f08dfdcdd6d6f4cb476a35a8f70bfc069c | /source/project_test/common/common_autotest.cpp | ef9c222eb53a0920e1772ee131e0124c679ee798 | [
"OpenSSL",
"MIT"
] | permissive | bluebackblue/brownie | fad5c4a013291e0232ab0c566bee22970d18bd58 | 917fcc71e5b0a807c0a8dab22a9ca7f3b0d60917 | refs/heads/master | 2021-01-20T04:47:08.775947 | 2018-11-20T19:38:42 | 2018-11-20T19:38:42 | 89,730,769 | 0 | 0 | MIT | 2017-12-31T13:44:33 | 2017-04-28T17:48:23 | C++ | UTF-8 | C++ | false | false | 4,180 | cpp | common_autotest.cpp |
/**
* Copyright (c) blueback
* Released under the MIT License
* https://github.com/bluebackblue/brownie/blob/master/LICENSE.txt
* http://bbbproject.sakura.ne.jp/wordpress/mitlicense
* @brief 自動テスト。
*/
/** include
*/
#pragma warning(push)
#pragma warning(disable:4464)
#include "../include.h"
#pragma warning(pop)
/** include
*/
#include "./common_autotest.h"
#include "./common_debug_callback.h"
/** warning
4710 : この関数はインライン展開のために選択されましたが、コンパイラはインライン展開を実行しませんでした。
*/
#pragma warning(disable:4710)
/** NTest
*/
#if(DEF_TEST_AUTO)
namespace NTest{namespace NCommon
{
/** constructor
*/
AutoTest::AutoTest()
:
action_start(false),
action_end(false),
#if(BSYS_D3D11_ENABLE)
d3d11(),
#endif
capture_step(-1),
#if(BSYS_TEXTURE_ENABLE)
capture_texture(),
#endif
capture_jpg(),
capture_jpg_size(0),
send_step(-1),
#if(BSYS_HTTP_ENABLE)
send_http(),
#endif
send_recvbuffer()
{
}
/** destructor
*/
AutoTest::~AutoTest()
{
}
/** 更新。
*/
void AutoTest::Update()
{
if(this->capture_step == 0){
//スクリーンショット。
#if((BSYS_TEXTURE_ENABLE)&&(BSYS_D3D11_ENABLE))
this->capture_texture = this->d3d11->Render_ScreenShot();
#endif
this->capture_step++;
}else if(this->capture_step == 1){
//JPGエンコード。
std::tuple<sharedptr<u8>,s32> t_jpg_data;
#if(BSYS_TEXTURE_ENABLE)
t_jpg_data = NBsys::NTexture::EncodeToJpg(this->capture_texture);
#endif
this->capture_jpg = std::get<0>(t_jpg_data);
this->capture_jpg_size = std::get<1>(t_jpg_data);
this->capture_step++;
}else if(this->capture_step == 2){
//送信リクエスト。
this->capture_step = -1;
this->send_step = 0;
}
if(this->send_step == 0){
//通信開始。
#if(BSYS_HTTP_ENABLE)
this->send_http.reset(new NBsys::NHttp::Http());
this->send_http->SetHost("bbbproject.sakura.ne.jp");
this->send_http->SetPort(80);
this->send_http->SetMode(NBsys::NHttp::Http_Mode::Post);
this->send_http->SetUrl("/www/project_autotest/index.php?mode=upload");
this->send_http->AddPostContent("upfile","filename",this->capture_jpg,this->capture_jpg_size);
//テスト番号。
{
char t_buffer[16];
STLString t_index_string = VASTRING(t_buffer,sizeof(t_buffer),"%d",DEF_TEST_INDEX);
this->send_http->AddPostContent("index",t_index_string);
}
//タイトル名。
{
STLWString t_title = DEF_TEST_STRING;
STLString t_title_utf8;
WcharToChar(t_title,t_title_utf8);
this->send_http->AddPostContent("title",t_title_utf8);
}
//ログ。
{
STLWString t_log;
for(s32 ii=0;ii<=NCommon::GetDegubLogMax();ii++){
t_log += NCommon::GetDebugLogString(ii);
t_log += L"\n";
}
STLString t_log_utf8;
WcharToChar(t_log,t_log_utf8);
this->send_http->AddPostContent("log",t_log_utf8);
}
this->send_recvbuffer.reset(new RingBuffer<u8,1*1024*1024,true>());
this->send_http->ConnectStart(this->send_recvbuffer);
#endif
this->send_step++;
}else if(this->send_step == 1){
//通信中。
#if(BSYS_HTTP_ENABLE)
bool t_ret = this->send_http->ConnectUpdate();
if((t_ret == true)||(this->send_recvbuffer->GetUseSize()>0)){
//u8* t_recv_data = this->send_recvbuffer->GetItemFromUseList(0);
//s32 t_recv_size = this->send_recvbuffer->GetUseSize();
if(this->send_http->IsRecvHeader()){
//ヘッダー読み込み済み。
//リングバッファからデータを取得したことにする。
this->send_recvbuffer->AddFree(this->send_recvbuffer->GetUseSize());
}
}else{
this->send_http->ConnectEnd();
this->send_http.reset();
this->send_step++;
}
#else
{
this->send_step++;
}
#endif
}else if(this->send_step == 2){
//終了。
this->action_end = true;
this->send_step = -1;
}
}
}}
#endif
|
38db4cdc0f1a1e541e7715be302faf5171c07459 | 95d7164ebf8d73bcb89ea155940de9909df20477 | /max_range_sum_query.cpp | 75ae420c93138b42138b699141d329d80f827713 | [] | no_license | imvamshi/Standard | 6788defe1dc1f9540d3027f831bee742717e419c | 6a05b64e8093ff2ce60abcebcfe31b2f65e6d929 | refs/heads/master | 2021-01-10T09:44:16.426818 | 2016-04-06T10:17:22 | 2016-04-06T10:17:22 | 48,443,393 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,874 | cpp | max_range_sum_query.cpp | #include <cstdio>
#include <algorithm>
#define N 70000
using namespace std;
struct seg{
int lsum, rsum, msum;//, sum;
};
int arr[N+1];
seg tree[4*N + 1];
int sum[N+1];
// Building segment tree
void build(int node, int l, int r) {
if(l == r)
tree[node] = ( (seg){ arr[l], arr[l], arr[l] } );
else {
build( 2 * node, l, (l + r)/2 );
build( 2 * node + 1, (l + r)/2 + 1, r );
seg left = tree[2 * node];
seg right = tree[2 * node + 1];
//tree[node].sum = left.sum + right.sum;
tree[node].lsum = max(left.lsum, sum[(l + r)/2] - sum[l-1] + right.lsum);
tree[node].rsum = max(right.rsum, sum[r] - sum[(l + r)/2] + left.rsum);
tree[node].msum = max(left.msum, max(right.msum, left.rsum + right.lsum));
//tree[node].lsum = max(tree[ 2 * node].lsum, tree[2 * node].msum + tree[ 2 * node + 1].lsum);
//tree[node].rsum = max(tree[ 2 * node + 1].rsum, tree[2 * node + 1].msum + tree[2 * node].rsum);
}
}
seg query(int node, int a, int b, int range_a, int range_b){
//cout<<"entered query : Querying "<<a<<" "<< b <<endl;
int m = (a + b)/2;
if(range_a == a && range_b == b)
return tree[node];
// // as j being the largest index in the given range i.e.,(i,j)
// if j<=m then we can completely depend on the left child's data ( to obt the sum for given range)
else if(range_b <= m)
return query( 2 * node, a, m, range_a, range_b);
// as i being the smallest index in the given range i.e.,(i,j)
// if i > m then we can completely depend on the right child's data ( to obt the sum for given range)
// AND ALSO , if it were i>=m then i == j
if(range_a > m)
return query( 2 * node + 1, m+1, b, range_a, range_b);
// left_result_query && right_result_query
// obtain max sum by data available with left and right
seg left_result = query( 2*node, a, m, range_a, m);
seg right_result = query(2*node + 1, m+1, b, m+1, range_b);
//seg left = tree[2*node], right = tree[2*node+1];
// this return call is(very important) to obtain the max sum from splitting the query into two halves
// i.e., to merge the sum obtained rom the left & right (queries).
// A G G R E G A T I O N
return ((seg){
max(left_result.lsum, sum[m] - sum[range_a - 1] + right_result.lsum),
max(right_result.rsum, sum[b] - sum[m] + left_result.rsum),
max(left_result.msum, max(right_result.msum, left_result.rsum + right_result.lsum))
//left_result.sum + right_result.sum
});
}
int main(){
int n;
//ios_base::sync_with_stdio(false);
scanf("%d", &n);
for(int i = 0; i < n; i++){
scanf("%d", arr + i);
if(i == 0) sum[i] = arr[i];
else
sum[i] = sum[i-1] + arr[i];
}
build(1, 0, n-1);
int Q;
scanf("%d", &Q);
int l,r;
while(Q--){
scanf( "%d%d", &l, &r);
printf( "%d\n",query(1, 0, n-1, --l, --r).msum);
// query returns a node <structure>
// we are accessing the varible msum of that node
// as msum is the maximum sum
}
return 0;
}
|
812c99a8747114b47035f0d44e73d8ad738d2dff | 77aac5d1b49677685cb289ab62134d3fbf3db525 | /I2C/i2c_rtc_R8564_test/i2c_rtc_R8564_test.ino | fb7dc07f0136ce996b79c6d20d0fa7f8be38ef61 | [] | no_license | skeimeier/Arduino | f491cb2c4d6b793cd4bc1474f9a186c6397dc7a5 | 8fefeb9f389d7471e4e4243df7983c1619cc0a32 | refs/heads/master | 2021-01-01T18:22:57.874969 | 2015-09-17T08:07:57 | 2015-09-17T08:07:57 | 17,796,025 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,055 | ino | i2c_rtc_R8564_test.ino |
#include <Ports.h>
PortI2C myI2C (1);
DeviceI2C clock (myI2C,0x51); // clockchip = r8564je
void setup() {
Serial.begin(57600);
Serial.println("\n[clock]");
bool ok = clock.isPresent();
Serial.println(ok?"da":"weg");
if(ok){
Serial.println("Init");
clock.send();
clock.write(2);
clock.receive();
byte result = clock.read(1);
clock.stop();
Serial.println(result);
//
//setTime();
}
}
void setTime(){
Serial.println("SetTime");
clock.send();
clock.write(0); // Register 0
clock.write(0b00100000);// Stop
clock.write(0);
clock.write(0); // sekunden
clock.write(0x45); //minute
clock.write(0x09);// hour
clock.write(0x06); // days
clock.write(0x06); // wday
clock.write(0x7); // month
clock.write(0x12); // year
clock.stop();
clock.send();
clock.write(0); // Register 0
clock.write(0);// Stop sua
clock.stop();
Serial.println("Done");
}
void loop() {
delay(1000);
clock.send();
clock.write(2);
clock.receive();
byte second = clock.read(1);
clock.receive();
byte minute = clock.read(1);
clock.receive();
byte hour = clock.read(1);
clock.receive();
byte day = clock.read(1);
clock.receive();
byte wday = clock.read(1);
clock.receive();
byte month = clock.read(1);
clock.receive();
byte year = clock.read(1);
clock.receive();
clock.stop();
Serial.print("Time: ");
Serial.print(hour & 0b00111111,HEX);
Serial.print(":");
Serial.print(minute & 0b01111111,HEX);
Serial.print(":");
Serial.println(second & 0b01111111,HEX);
Serial.print("Date: ");
Serial.print(wday & 0b111,HEX);
Serial.print(" ");
Serial.print(day & 0b00111111,HEX);
Serial.print(".");
Serial.print((month & 0b00011111),HEX);
Serial.print(".");
Serial.print("20");
Serial.println(year ,HEX);
}
|
bfccacd39e5e4a7ed44ed9f29974612f90c13d00 | 531cb8c7f8cd08da3012a10369eba392d798677a | /game/entities.h | 5ad8dec28d3e6fc9c5a5e66a369df96226da4813 | [] | no_license | bit-hack/7drl | 38ece6c8c5e631a87ea67256d98713c422ac2ff9 | 7726263045d1d4dd751a05cbd428e964ff2ba456 | refs/heads/master | 2023-03-22T09:22:59.521751 | 2021-03-16T22:43:32 | 2021-03-16T22:43:32 | 344,281,010 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 10,476 | h | entities.h | #pragma once
#include <cstdio>
// librl
#include "gc.h"
#include "raycast.h"
// game
#include "enums.h"
#include "inventory.h"
namespace game {
struct game_t;
enum subclass_t {
ent_subclass_actor,
ent_subclass_item,
ent_subclass_equip,
};
struct entity_t : librl::gc_base_t {
entity_t(const uint32_t type, const uint32_t subclass, game::game_t &game)
: pos(librl::int2{ -1, -1 })
, type(type)
, subclass(subclass)
, game(game)
{
}
virtual void render() = 0;
virtual bool turn() = 0;
template <typename type_t>
type_t* as_a() {
return (subclass == type_t::SUBCLASS || type == type_t::TYPE)
? static_cast<type_t*>(this) : nullptr;
}
template <typename type_t>
const type_t* as_a() const {
return (subclass == type_t::SUBCLASS || type == type_t::TYPE)
? static_cast<const type_t*>(this) : nullptr;
}
template <typename type_t>
bool is_type() const {
return type_t::TYPE == type;
}
template <typename type_t>
bool is_subclass() const {
return type_t::SUBCLASS == subclass;
}
librl::int2 pos;
const uint32_t type;
const uint32_t subclass;
std::string name;
protected:
game::game_t &game;
};
struct entity_actor_t : public entity_t {
static const subclass_t SUBCLASS = ent_subclass_actor;
static const uint32_t TYPE = -1;
entity_actor_t(const uint32_t type, game::game_t &game)
: entity_t(type, SUBCLASS, game)
, hp(0)
, hp_max(0)
{
}
virtual int32_t get_damage() const { return inventory.get_damage(); }
virtual int32_t get_defense() const { return inventory.get_defense(); }
virtual int32_t get_accuracy() const { return inventory.get_accuracy(); }
virtual int32_t get_evasion() const { return inventory.get_evasion(); }
virtual int32_t get_crit() const { return inventory.get_crit(); }
virtual void attack(entity_actor_t *target);
virtual void kill();
virtual void on_take_damage(int32_t damage, entity_t *from) {};
virtual void on_give_damage(int32_t damage, entity_t *to) {};
int32_t hp;
int32_t hp_max;
inventory_t inventory;
};
struct entity_item_t : public entity_t {
static const subclass_t SUBCLASS = ent_subclass_item;
static const uint32_t TYPE = -1;
entity_item_t(const uint32_t type, game::game_t &game, bool can_pickup)
: entity_t(type, SUBCLASS, game)
, can_pickup(can_pickup)
{
}
bool turn() override {
return true;
}
virtual void use_on(entity_t *e) = 0;
virtual void picked_up(entity_t *by);
void render() override;
bool can_pickup;
char glyph;
uint32_t colour;
};
struct entity_equip_t : public entity_t {
static const subclass_t SUBCLASS = ent_subclass_equip;
static const uint32_t TYPE = -1;
entity_equip_t(const uint32_t type, game::game_t &game)
: entity_t(type, SUBCLASS, game)
, damage(0)
, accuracy(0)
, evasion(0)
, defense(0)
, crit(0)
{
glyph = '?';
colour = colour_item;
}
bool turn() override {
return true;
}
virtual void picked_up(entity_t *by);
void render() override;
int32_t damage;
int32_t accuracy;
int32_t evasion;
int32_t defense;
int32_t crit;
char glyph;
uint32_t colour;
};
struct ent_player_t : public entity_actor_t {
static const uint32_t TYPE = ent_type_player;
ent_player_t(game_t &game);
int32_t get_accuracy() const override { return entity_actor_t::get_accuracy() + 50; }
int32_t get_damage() const override { return entity_actor_t::get_damage() + 10; }
int32_t get_defense() const override { return entity_actor_t::get_defense() + 0; }
int32_t get_evasion() const override { return entity_actor_t::get_evasion() + 10; }
int32_t get_crit() const override { return entity_actor_t::get_crit() + 2; }
void render() override;
void kill() override;
void interact_with(entity_t *e);
bool turn() override;
void _enumerate(librl::gc_enum_t &func) override;
void on_give_damage(int32_t damage, entity_t *to) override;
uint32_t gold;
uint32_t xp;
librl::int2 user_dir;
};
struct ent_enemy_t : public entity_actor_t {
ent_enemy_t(uint32_t type, game::game_t &game);
void render() override;
void interact_with(entity_t *e);
bool turn() override;
bool move_random();
bool move_pfield(int dir = 1);
int32_t get_accuracy() const override { return accuracy; }
int32_t get_damage() const override { return damage; }
int32_t get_defense() const override { return defense; }
int32_t get_evasion() const override { return evasion; }
int32_t get_crit() const override { return crit; }
int32_t accuracy;
int32_t damage;
int32_t defense;
int32_t evasion;
int32_t crit;
uint8_t sense;
uint32_t colour;
char glyph;
uint64_t seed;
};
struct ent_goblin_t : public ent_enemy_t {
static const uint32_t TYPE = ent_type_goblin;
ent_goblin_t(game::game_t &game)
: ent_enemy_t(TYPE, game)
{
name = "goblin";
hp = 30;
accuracy = 40;
damage = 8;
glyph = 'g';
colour = colour_goblin;
}
};
struct ent_vampire_t : public ent_enemy_t {
static const uint32_t TYPE = ent_type_vampire;
ent_vampire_t(game::game_t &game)
: ent_enemy_t(TYPE, game)
{
name = "vampire";
hp = 50;
accuracy = 75;
damage = 15;
glyph = 'v';
colour = colour_vampire;
sense = 245;
}
bool turn() override {
hp += hp >= 50 ? 0 : 2;
if (move_pfield(hp <= 15 ? -1 : 1)) {
return true;
}
if (move_random()) {
return true;
}
return true;
}
void on_give_damage(int32_t damage, entity_t *) override;
};
struct ent_ogre_t : public ent_enemy_t {
static const uint32_t TYPE = ent_type_ogre;
ent_ogre_t(game::game_t &game)
: ent_enemy_t(TYPE, game)
{
name = "ogre";
hp = 170;
accuracy = 75;
damage = 16;
glyph = 'o';
colour = colour_ogre;
sense = 245;
}
};
struct ent_wrath_t : public ent_enemy_t {
static const uint32_t TYPE = ent_type_wrath;
ent_wrath_t(game::game_t &game)
: ent_enemy_t(TYPE, game)
, timer(2)
{
name = "wrath";
hp = 75;
accuracy = 90;
damage = 15;
glyph = 'w';
colour = colour_wrath;
sense = 245;
}
void teleport_to_pos(const librl::int2 &p);
bool turn() override;
int timer;
};
struct ent_dwarf_t : public ent_enemy_t {
static const uint32_t TYPE = ent_type_dwarf;
ent_dwarf_t(game::game_t &game)
: ent_enemy_t(TYPE, game)
{
name = "dwarf";
hp = 80;
accuracy = 75;
damage = 20;
glyph = 'd';
colour = colour_dwarf;
sense = 248;
}
bool turn() override;
};
struct ent_warlock_t : public ent_enemy_t {
static const uint32_t TYPE = ent_type_warlock;
static const uint32_t spawn_time = 10;
ent_warlock_t(game::game_t &game)
: ent_enemy_t(TYPE, game)
, timer(spawn_time / 2)
{
name = "warlock";
hp = 25;
accuracy = 50;
damage = 5;
glyph = 'W';
colour = colour_warlock;
sense = 250;
}
void spawn_skeleton();
bool turn() override;
uint32_t timer;
};
struct ent_skeleton_t : public ent_enemy_t {
static const uint32_t TYPE = ent_type_mimic;
ent_skeleton_t(game::game_t &game)
: ent_enemy_t(TYPE, game)
{
name = "skeleton";
hp = 80;
accuracy = 75;
damage = 20;
glyph = 's';
sense = 230;
colour = colour_skeleton;
}
};
struct ent_mimic_t : public ent_enemy_t {
static const uint32_t TYPE = ent_type_mimic;
ent_mimic_t(game::game_t &game);
bool turn() override {
if (trigger) {
return ent_enemy_t::turn();
}
return true;
}
void on_take_damage(int32_t damage, entity_t *) override {
trigger = true;
}
bool trigger;
};
struct ent_potion_t : public entity_item_t {
static const uint32_t TYPE = ent_type_potion;
ent_potion_t(game::game_t &game)
: entity_item_t(TYPE, game, /* can_pickup */ true)
, recovery(20)
{
name = "potion";
glyph = 'p';
colour = colour_potion;
}
void use_on(entity_t *e);
const uint32_t recovery;
};
struct ent_stairs_t : public entity_item_t {
// note: make sure to place where it wont get in the way of a corridor
static const uint32_t TYPE = ent_type_stairs;
ent_stairs_t(game::game_t &game)
: entity_item_t(TYPE, game, /* can_pickup */ false)
, seen(false)
{
name = "stairs";
glyph = '=';
colour = colour_stairs;
}
void use_on(entity_t *e);
bool seen;
};
struct ent_gold_t : public entity_item_t {
static const uint32_t TYPE = ent_type_gold;
ent_gold_t(game::game_t &game);
void use_on(entity_t *e);
uint64_t seed;
};
struct ent_club_t : public entity_equip_t {
static const uint32_t TYPE = ent_type_club;
ent_club_t(game::game_t &game)
: entity_equip_t(TYPE, game)
{
name = "club";
damage = 4;
evasion = -1;
}
};
struct ent_mace_t : public entity_equip_t {
static const uint32_t TYPE = ent_type_mace;
ent_mace_t(game::game_t &game)
: entity_equip_t(TYPE, game)
{
name = "mace";
damage = 6;
evasion = -1;
}
};
struct ent_sword_t : public entity_equip_t {
static const uint32_t TYPE = ent_type_sword;
ent_sword_t(game::game_t &game)
: entity_equip_t(TYPE, game)
{
name = "sword";
damage = 8;
}
};
struct ent_dagger_t : public entity_equip_t {
static const uint32_t TYPE = ent_type_dagger;
ent_dagger_t(game::game_t &game)
: entity_equip_t(TYPE, game)
{
name = "dagger";
damage = 6;
evasion = 2;;
}
};
struct ent_leather_armour_t : public entity_equip_t {
static const uint32_t TYPE = ent_type_leather_armour;
ent_leather_armour_t(game::game_t &game)
: entity_equip_t(TYPE, game)
{
name = "leather armour";
defense = 4;
}
};
struct ent_shield_t : public entity_equip_t {
static const uint32_t TYPE = ent_type_shield;
ent_shield_t(game::game_t &game)
: entity_equip_t(TYPE, game)
{
name = "shield";
defense = 3;
evasion = 2;
}
};
struct ent_metal_armour_t : public entity_equip_t {
static const uint32_t TYPE = ent_type_metal_armour;
ent_metal_armour_t(game::game_t &game)
: entity_equip_t(TYPE, game)
{
name = "leather armour";
defense = 6;
evasion = -1;
}
};
struct ent_cloak_t : public entity_equip_t {
static const uint32_t TYPE = ent_type_cloak;
ent_cloak_t(game::game_t &game)
: entity_equip_t(TYPE, game)
{
name = "cloak";
defense = 3;
evasion = 2;
}
};
} // game
|
e6ad36fd8562c56bc9b5c295f868ca3f0c0e4279 | 2cec9f07a88b874a01e022004fe72814bdcae22f | /code/box/cppbox.cpp | 0a4a921dbfdae5f63799d87b5f717a73d006f90d | [] | no_license | fmorgner/building-reusable-libraries | 0fe239ce60140ad1c79ece2a998461bb2d8b9c49 | 44617e20a938bfc7d5dafec139e2ea46cd48bd79 | refs/heads/master | 2021-01-17T15:47:03.388671 | 2016-09-26T20:11:38 | 2016-10-04T06:55:20 | 69,941,419 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 128 | cpp | cppbox.cpp | #include "box.hpp"
#include <iostream>
int main() {
cppug::box box{3};
box.push(42);
std::cout << box.pop() << '\n';
}
|
f942c7084a1aa3060ffacf95016cde8c30935958 | 1fc0bd6ff8419f794ba386d8dc1c3ac8abf4c395 | /src/utils/coords.hh | 8f04d7e26a0d8b6a2c776c8d32b2fed5054a2ed6 | [] | no_license | Aufinal/advent2019 | dc1958522fe95d86c3b1ad732c372af1b96a49e3 | ca11f9e336a5b72b50101031d09904e1f5a60c18 | refs/heads/master | 2023-04-04T02:03:12.959720 | 2021-04-04T22:44:00 | 2021-04-04T22:44:00 | 345,462,791 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,343 | hh | coords.hh | #include <cmath>
#include <cstdlib>
#include <functional>
#include <iostream>
using namespace std;
// Complex coordinates for 2d plane
class Coord {
public:
int x;
int y;
Coord(int x, int y) : x(x), y(y) {}
Coord() : x(0), y(0) {}
int norm1() const { return abs(x) + abs(y); }
int normsq() const { return x * x + y * y; }
float arg() const { return atan2(y, x); }
Coord& operator=(const Coord& rhs) {
x = rhs.x;
y = rhs.y;
return *this;
}
Coord& operator+=(const Coord& rhs) {
x += rhs.x;
y += rhs.y;
return *this;
}
Coord operator-=(const Coord& rhs) { return *(this) += -rhs; }
Coord& operator*=(const int& rhs) {
x *= rhs;
y *= rhs;
return *this;
}
Coord& operator*=(const Coord& rhs) {
int new_x = x * rhs.x - y * rhs.y;
y = y * rhs.x + x * rhs.y;
x = new_x;
return *this;
}
Coord& operator/=(const int& n) {
x /= n;
y /= n;
return *this;
}
Coord operator-() const { return Coord(-x, -y); }
};
Coord operator+(Coord lhs, const Coord& rhs) { return lhs += rhs; }
Coord operator-(Coord lhs, const Coord& rhs) { return lhs -= rhs; }
Coord operator*(Coord lhs, const int& rhs) { return lhs *= rhs; }
Coord operator*(const int& lhs, Coord rhs) { return rhs *= lhs; }
Coord operator*(Coord lhs, const Coord& rhs) { return lhs *= rhs; }
Coord operator/(Coord lhs, const int& rhs) { return lhs /= rhs; }
bool operator<(const Coord& lhs, const Coord& rhs) {
return tie(lhs.x, lhs.y) < tie(rhs.x, rhs.y);
}
bool operator>(const Coord& lhs, const Coord& rhs) { return rhs < lhs; }
bool operator==(const Coord& lhs, const Coord& rhs) {
return tie(lhs.x, lhs.y) == tie(rhs.x, rhs.y);
}
bool operator!=(const Coord& lhs, const Coord& rhs) { return !(lhs == rhs); }
ostream& operator<<(ostream& os, const Coord& obj) {
os << '(' << obj.x << ',' << obj.y << ')';
return os;
}
namespace std {
template <>
struct hash<Coord> {
size_t operator()(Coord const& coord) const noexcept {
size_t h1 = hash<int>{}(coord.x);
size_t h2 = hash<int>{}(coord.y);
return h1 ^ (h2 << 1);
}
};
} // namespace std
const vector<Coord> directions = {Coord(0, 1), Coord(0, -1), Coord(-1, 0), Coord(1, 0)};
|
afc245ba8415f08f7b19f8894679ed1efdd62dbc | a5c3b4d98ddc0d9f919fa5597580cceb39bd5072 | /week_2/2018202143HHR/src/Utility.h | 915badc87120e7d97dc071065585c1e6649e3465 | [] | no_license | WhiteCatFly/Turing_Student_Code_2019 | 17f4ed781327706b14b66ef90b0b90478792915b | 4d744f6a3072dc9184c10c5daad60dee4a83a588 | refs/heads/master | 2021-06-15T02:32:07.977336 | 2019-07-05T07:06:32 | 2019-07-05T07:06:32 | 173,031,113 | 8 | 27 | null | 2020-01-09T01:44:23 | 2019-02-28T03:04:38 | C++ | UTF-8 | C++ | false | false | 313 | h | Utility.h | #ifndef _MENCI_WEB_CRAWLER_UTILITY_H
#define _MENCI_WEB_CRAWLER_UTILITY_H
#include <string>
bool checkSuffix(const std::string &str, const std::string &pattern);
bool checkPrefix(const std::string &str, const std::string &pattern);
void stringToLower(std::string &str);
#endif // _MENCI_WEB_CRAWLER_UTILITY_H
|
778ef6d810cb361551f1114023bcd424d5936d11 | 4c6ebdc4b6af073298c72698558b36b2cfa990d5 | /AulasLogicaFatec/ex14Porcentagem.cpp | 01c00071c29f703b8cb7786eba1f916ff4ec65fb | [
"MIT"
] | permissive | jonfisik/LogicaFatec | 0153a59dff4ea43c0809d1a0c993cb83fab2a7f0 | fb37d7f77c251154471b7db56eb1b57bf83bf3f2 | refs/heads/main | 2023-08-01T12:57:15.168443 | 2021-09-14T20:48:12 | 2021-09-14T20:48:12 | 350,490,645 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 550 | cpp | ex14Porcentagem.cpp | #include<stdio.h>
main(){
float caixa, quantidade, preco;
float valorCompra, limite, valorPagar;
printf("Qual o valor em caixa? R$ ");
scanf("%f", &caixa);
printf("Qual a quantidade? R$ ");
scanf("%f", &quantidade);
printf("Qual o preco? R$ ");
scanf("%f", &preco);
valorCompra = quantidade * preco;
limite = caixa * 0.8;
if(valorCompra > limite){
valorPagar = valorCompra * 1.10;
printf("Compra a prazo R$ %f.", valorPagar);
}else{
valorPagar = valorCompra * 0.95;
printf("Compra a vista R$ %f.", valorPagar);
}
}
|
1414b23eb5a3c00c19bc2575a0f2b7c889c9cdb7 | e3e5900c0c256b4df2738f392ba48a6b6d065434 | /cpp primer fourth ex/chapter_13/Ex_13_16/message.cpp | b2b3ffef58ef17098f271666e2181ec54f0a03d1 | [] | no_license | moononcloud/cpp-primer-4th-edition-exercises-keys | d7c6803fe3d2bb419da7a23724666b372b290798 | 91f339abc0947166264eef254654719facf07671 | refs/heads/master | 2020-04-06T07:17:16.795803 | 2016-08-29T08:48:33 | 2016-08-29T08:48:33 | 64,040,157 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 889 | cpp | message.cpp | #include "Message.hpp"
Message::Message(const Message&m):contents(m.contents),folders(m.folders)
{
put_Msg_in_Folders(folders);
}
Message& Message::operator=(const Message&rhs)
{
if(&rhs!=this)
{
remove_Msg_from_Folders();
contents=rhs.contents;
folders=rhs.folders;
put_Msg_in_Folders(folders);
}
return *this;
}
Message::~Message()
{
remove_Msg_from_Folders();
}
void Message::put_Msg_in_Folders(const std::set<Folder*>&rhs)
{
for(std::set<Folder*>::const_iterator bit=rhs.begin();
bit!=rhs.end();++bit)
(*bit)->addFldr(this);
}
void Message::remove_Msg_from_Folders()
{
for(std::set<Folder*>::const_iterator bit=folders.begin();
bit!=folders.end();++bit)
(*bit)->remFldr(this);
}
void Message::addFldr(Folder* ptF)
{
folders.insert(ptF);
}
void Message::remFldr(Folder* ptF)
{
folders.erase(ptF);
} |
96ee43e4f60671cf6fdcd6b354e0072c43a997c3 | 76bb2f1b416d78c2b4c951f071657b93e8f915c1 | /xlib/macro/brushhkl.cpp | 1db72049d1a2a6273b0381e4c347d3c392c02eb7 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | permissive | pcxod/olex2 | 2f48c06da586fb47d308defe9915bf63be5c8f4d | 17d2718d09ad61ad961b98e966d981bb50663e3e | refs/heads/master | 2023-08-11T20:01:31.660209 | 2023-07-21T10:55:35 | 2023-07-21T10:55:35 | 219,048,584 | 9 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,908 | cpp | brushhkl.cpp | /******************************************************************************
* Copyright (c) 2004-2011 O. Dolomanov, OlexSys *
* *
* This file is part of the OlexSys Development Framework. *
* *
* This source file is distributed under the terms of the licence located in *
* the root folder. *
******************************************************************************/
#include "egc.h"
#include "xmacro.h"
#include "hkl.h"
#include "symmlib.h"
#include "log.h"
struct HklBrushRef {
TReflection* ref;
int H, K, L;
bool Deleted;
HklBrushRef(TReflection &r) {
ref = &r;
H = r.GetH(); K = r.GetK(); L = r.GetL();
Deleted = false;
}
int CompareTo(const HklBrushRef &r) const {
int res = L - r.L;
if( res == 0 ) {
res = K - r.K;
if( res == 0 )
res = H - r.H;
}
return res;
}
template <class MatList> void Standardise(const MatList& ml, bool CheckInversion) {
for( size_t i=0; i < ml.Count(); i++ ) {
vec3i hklv = (*ref)*ml[i];
if( (hklv[2] > L) || // sdandardise then ...
((hklv[2] == L) && (hklv[1] > K)) ||
((hklv[2] == L) && (hklv[1] == K) && (hklv[0] > H)) ) {
H = hklv[0]; K = hklv[1]; L = hklv[2];
}
if( CheckInversion ) {
hklv *= -1;
if( (hklv[2] > L) ||
((hklv[2] == L) && (hklv[1] > K) ) ||
((hklv[2] == L) && (hklv[1] == K) && (hklv[0] > H)) ) {
H = hklv[0]; K = hklv[1]; L = hklv[2];
}
}
}
}
static int CompareHkl(const HklBrushRef &r1, const HklBrushRef &r2) {
return r1.CompareTo(r2);
}
static int CompareSig(const HklBrushRef &r1, const HklBrushRef &r2) {
return r1.CompareTo(r2);
}
};
void XLibMacros::macHklBrush(TStrObjList &Cmds, const TParamList &Options, TMacroData &E) {
TXApp &XApp = TXApp::GetInstance();
olxstr HklFN(XApp.XFile().LocateHklFile());
if( HklFN.IsEmpty() ) {
E.ProcessingError(__OlxSrcInfo, "could not locate HKL file");
return;
}
THklFile Hkl;
Hkl.LoadFromFile(HklFN, false);
TAsymmUnit& au = XApp.XFile().GetAsymmUnit();
TSpaceGroup &sg = TSymmLib::GetInstance().FindSG(au);
const bool useFriedelLaw = Options.Contains("f");
smatd_list ml;
sg.GetMatrices(ml, mattAll^(mattIdentity|mattCentering));
if( !sg.IsCentrosymmetric() && useFriedelLaw )
ml.InsertNew(0).r.I() *= -1;
TPtrList< HklBrushRef > refs, eqs;
refs.SetCapacity( Hkl.RefCount() );
for( size_t i=0; i < Hkl.RefCount(); i++ ) {
refs.Add(new HklBrushRef(Hkl[i]));
refs[i]->Standardise(ml, useFriedelLaw);
}
QuickSorter::SortSF(refs, HklBrushRef::CompareHkl);
eqs.Add(refs[0]); // reference reflection
for( size_t i=0; i < refs.Count(); ) {
while( (++i < refs.Count()) && (eqs[0]->CompareTo(*refs[i]) == 0) )
eqs.Add(refs[i]);
// do mergings etc
if( eqs.Count() > 3) {
QuickSorter::SortSF(eqs, HklBrushRef::CompareSig);
size_t ind = eqs.Count()-1;
while( eqs[ind]->ref->GetS() > 2*eqs[0]->ref->GetS() && --ind >= 2 ) {
eqs[ind]->Deleted = true;
}
}
if( i >= refs.Count() ) break;
eqs.Clear();
eqs.Add(refs[i]);
}
// keep the order in which equivalent refs are next to each other
TRefPList toSave;
toSave.SetCapacity(refs.Count());
size_t deletedRefs = 0;
for( size_t i=0; i < refs.Count(); i++ ) {
toSave.Add( refs[i]->ref );
if( refs[i]->Deleted ) {
refs[i]->ref->SetOmitted(true);
deletedRefs++;
}
delete refs[i];
}
XApp.NewLogEntry() << "Ommited " << deletedRefs << " reflections";
Hkl.SaveToFile("brushed.hkl", toSave);
}
|
7f548ccbd0c8a503287ec58eba83c7c44a61f87e | 818317dc61f59c498c185e2d0b26bf108fa19cc7 | /esp8266_zx81/z80.cpp | 2bfa6ff1c4ee238da7ee220238a4284171b67bf4 | [
"MIT"
] | permissive | joaquimorg/ESP8266 | b11616a8b503306515438becc94fcd53183731c6 | 66ef92543373d6b86c53422e04d443abd4a5eafb | refs/heads/master | 2021-01-10T09:58:37.835668 | 2017-01-04T11:17:59 | 2017-01-04T11:17:59 | 53,329,089 | 21 | 17 | null | null | null | null | UTF-8 | C++ | false | false | 82,853 | cpp | z80.cpp | /*********************************************************************************************
z80.c
z80 cpu emulation code
2013/10/30 S.Suwa http://www.suwa-koubou.jp
http://www.suwa-koubou.jp/micom/MZ80Emulator/mz80emu_en.html
*********************************************************************************************/
#include <ESP8266WiFi.h>
/*============================================================================================
z80 instruction functions
============================================================================================*/
void fnc_0x00(void); void fnc_0x01(void); void fnc_0x02(void); void fnc_0x03(void);
void fnc_0x04(void); void fnc_0x05(void); void fnc_0x06(void); void fnc_0x07(void);
void fnc_0x08(void); void fnc_0x09(void); void fnc_0x0a(void); void fnc_0x0b(void);
void fnc_0x0c(void); void fnc_0x0d(void); void fnc_0x0e(void); void fnc_0x0f(void);
void fnc_0x10(void); void fnc_0x11(void); void fnc_0x12(void); void fnc_0x13(void);
void fnc_0x14(void); void fnc_0x15(void); void fnc_0x16(void); void fnc_0x17(void);
void fnc_0x18(void); void fnc_0x19(void); void fnc_0x1a(void); void fnc_0x1b(void);
void fnc_0x1c(void); void fnc_0x1d(void); void fnc_0x1e(void); void fnc_0x1f(void);
void fnc_0x20(void); void fnc_0x21(void); void fnc_0x22(void); void fnc_0x23(void);
void fnc_0x24(void); void fnc_0x25(void); void fnc_0x26(void); void fnc_0x27(void);
void fnc_0x28(void); void fnc_0x29(void); void fnc_0x2a(void); void fnc_0x2b(void);
void fnc_0x2c(void); void fnc_0x2d(void); void fnc_0x2e(void); void fnc_0x2f(void);
void fnc_0x30(void); void fnc_0x31(void); void fnc_0x32(void); void fnc_0x33(void);
void fnc_0x34(void); void fnc_0x35(void); void fnc_0x36(void); void fnc_0x37(void);
void fnc_0x38(void); void fnc_0x39(void); void fnc_0x3a(void); void fnc_0x3b(void);
void fnc_0x3c(void); void fnc_0x3d(void); void fnc_0x3e(void); void fnc_0x3f(void);
void fnc_0x40(void); void fnc_0x41(void); void fnc_0x42(void); void fnc_0x43(void);
void fnc_0x44(void); void fnc_0x45(void); void fnc_0x46(void); void fnc_0x47(void);
void fnc_0x48(void); void fnc_0x49(void); void fnc_0x4a(void); void fnc_0x4b(void);
void fnc_0x4c(void); void fnc_0x4d(void); void fnc_0x4e(void); void fnc_0x4f(void);
void fnc_0x50(void); void fnc_0x51(void); void fnc_0x52(void); void fnc_0x53(void);
void fnc_0x54(void); void fnc_0x55(void); void fnc_0x56(void); void fnc_0x57(void);
void fnc_0x58(void); void fnc_0x59(void); void fnc_0x5a(void); void fnc_0x5b(void);
void fnc_0x5c(void); void fnc_0x5d(void); void fnc_0x5e(void); void fnc_0x5f(void);
void fnc_0x60(void); void fnc_0x61(void); void fnc_0x62(void); void fnc_0x63(void);
void fnc_0x64(void); void fnc_0x65(void); void fnc_0x66(void); void fnc_0x67(void);
void fnc_0x68(void); void fnc_0x69(void); void fnc_0x6a(void); void fnc_0x6b(void);
void fnc_0x6c(void); void fnc_0x6d(void); void fnc_0x6e(void); void fnc_0x6f(void);
void fnc_0x70(void); void fnc_0x71(void); void fnc_0x72(void); void fnc_0x73(void);
void fnc_0x74(void); void fnc_0x75(void); void fnc_0x76(void); void fnc_0x77(void);
void fnc_0x78(void); void fnc_0x79(void); void fnc_0x7a(void); void fnc_0x7b(void);
void fnc_0x7c(void); void fnc_0x7d(void); void fnc_0x7e(void); void fnc_0x7f(void);
void fnc_0x80(void); void fnc_0x81(void); void fnc_0x82(void); void fnc_0x83(void);
void fnc_0x84(void); void fnc_0x85(void); void fnc_0x86(void); void fnc_0x87(void);
void fnc_0x88(void); void fnc_0x89(void); void fnc_0x8a(void); void fnc_0x8b(void);
void fnc_0x8c(void); void fnc_0x8d(void); void fnc_0x8e(void); void fnc_0x8f(void);
void fnc_0x90(void); void fnc_0x91(void); void fnc_0x92(void); void fnc_0x93(void);
void fnc_0x94(void); void fnc_0x95(void); void fnc_0x96(void); void fnc_0x97(void);
void fnc_0x98(void); void fnc_0x99(void); void fnc_0x9a(void); void fnc_0x9b(void);
void fnc_0x9c(void); void fnc_0x9d(void); void fnc_0x9e(void); void fnc_0x9f(void);
void fnc_0xa0(void); void fnc_0xa1(void); void fnc_0xa2(void); void fnc_0xa3(void);
void fnc_0xa4(void); void fnc_0xa5(void); void fnc_0xa6(void); void fnc_0xa7(void);
void fnc_0xa8(void); void fnc_0xa9(void); void fnc_0xaa(void); void fnc_0xab(void);
void fnc_0xac(void); void fnc_0xad(void); void fnc_0xae(void); void fnc_0xaf(void);
void fnc_0xb0(void); void fnc_0xb1(void); void fnc_0xb2(void); void fnc_0xb3(void);
void fnc_0xb4(void); void fnc_0xb5(void); void fnc_0xb6(void); void fnc_0xb7(void);
void fnc_0xb8(void); void fnc_0xb9(void); void fnc_0xba(void); void fnc_0xbb(void);
void fnc_0xbc(void); void fnc_0xbd(void); void fnc_0xbe(void); void fnc_0xbf(void);
void fnc_0xc0(void); void fnc_0xc1(void); void fnc_0xc2(void); void fnc_0xc3(void);
void fnc_0xc4(void); void fnc_0xc5(void); void fnc_0xc6(void); void fnc_0xc7(void);
void fnc_0xc8(void); void fnc_0xc9(void); void fnc_0xca(void); void fnc_0xcb(void);
void fnc_0xcc(void); void fnc_0xcd(void); void fnc_0xce(void); void fnc_0xcf(void);
void fnc_0xd0(void); void fnc_0xd1(void); void fnc_0xd2(void); void fnc_0xd3(void);
void fnc_0xd4(void); void fnc_0xd5(void); void fnc_0xd6(void); void fnc_0xd7(void);
void fnc_0xd8(void); void fnc_0xd9(void); void fnc_0xda(void); void fnc_0xdb(void);
void fnc_0xdc(void); void fnc_0xdd(void); void fnc_0xde(void); void fnc_0xdf(void);
void fnc_0xe0(void); void fnc_0xe1(void); void fnc_0xe2(void); void fnc_0xe3(void);
void fnc_0xe4(void); void fnc_0xe5(void); void fnc_0xe6(void); void fnc_0xe7(void);
void fnc_0xe8(void); void fnc_0xe9(void); void fnc_0xea(void); void fnc_0xeb(void);
void fnc_0xec(void); void fnc_0xed(void); void fnc_0xee(void); void fnc_0xef(void);
void fnc_0xf0(void); void fnc_0xf1(void); void fnc_0xf2(void); void fnc_0xf3(void);
void fnc_0xf4(void); void fnc_0xf5(void); void fnc_0xf6(void); void fnc_0xf7(void);
void fnc_0xf8(void); void fnc_0xf9(void); void fnc_0xfa(void); void fnc_0xfb(void);
void fnc_0xfc(void); void fnc_0xfd(void); void fnc_0xfe(void); void fnc_0xff(void);
// instruction code 0xedxx
void fnc_0xed40(void); void fnc_0xed41(void); void fnc_0xed42(void); void fnc_0xed43(void);
void fnc_0xed44(void); void fnc_0xed45(void); void fnc_0xed46(void); void fnc_0xed47(void);
void fnc_0xed48(void); void fnc_0xed49(void); void fnc_0xed4a(void); void fnc_0xed4b(void);
void fnc_0xed4d(void); void fnc_0xed4f(void); void fnc_0xed50(void); void fnc_0xed51(void);
void fnc_0xed52(void); void fnc_0xed53(void); void fnc_0xed56(void); void fnc_0xed57(void);
void fnc_0xed58(void); void fnc_0xed59(void); void fnc_0xed5a(void); void fnc_0xed5b(void);
void fnc_0xed5e(void); void fnc_0xed5f(void); void fnc_0xed60(void); void fnc_0xed61(void);
void fnc_0xed62(void); void fnc_0xed63(void); void fnc_0xed67(void); void fnc_0xed68(void);
void fnc_0xed69(void); void fnc_0xed6a(void); void fnc_0xed6b(void); void fnc_0xed6f(void);
void fnc_0xed72(void); void fnc_0xed73(void); void fnc_0xed78(void); void fnc_0xed79(void);
void fnc_0xed7a(void); void fnc_0xed7b(void); void fnc_0xeda0(void); void fnc_0xeda1(void);
void fnc_0xeda2(void); void fnc_0xeda3(void); void fnc_0xeda8(void); void fnc_0xeda9(void);
void fnc_0xedaa(void); void fnc_0xedab(void); void fnc_0xedb0(void); void fnc_0xedb1(void);
void fnc_0xedb2(void); void fnc_0xedb3(void); void fnc_0xedb8(void); void fnc_0xedb9(void);
void fnc_0xedba(void); void fnc_0xedbb(void); void fnc_0xedfc(void); void fnc_0xedfd(void);
void fnc_0xedfe(void); void fnc_0xedff(void); void fnc_0xedXX(void);
/*============================================================================================
global variable
============================================================================================*/
static void (*z80ops[])(void) = {
fnc_0x00, fnc_0x01, fnc_0x02, fnc_0x03, fnc_0x04, fnc_0x05, fnc_0x06, fnc_0x07,
fnc_0x08, fnc_0x09, fnc_0x0a, fnc_0x0b, fnc_0x0c, fnc_0x0d, fnc_0x0e, fnc_0x0f,
fnc_0x10, fnc_0x11, fnc_0x12, fnc_0x13, fnc_0x14, fnc_0x15, fnc_0x16, fnc_0x17,
fnc_0x18, fnc_0x19, fnc_0x1a, fnc_0x1b, fnc_0x1c, fnc_0x1d, fnc_0x1e, fnc_0x1f,
fnc_0x20, fnc_0x21, fnc_0x22, fnc_0x23, fnc_0x24, fnc_0x25, fnc_0x26, fnc_0x27,
fnc_0x28, fnc_0x29, fnc_0x2a, fnc_0x2b, fnc_0x2c, fnc_0x2d, fnc_0x2e, fnc_0x2f,
fnc_0x30, fnc_0x31, fnc_0x32, fnc_0x33, fnc_0x34, fnc_0x35, fnc_0x36, fnc_0x37,
fnc_0x38, fnc_0x39, fnc_0x3a, fnc_0x3b, fnc_0x3c, fnc_0x3d, fnc_0x3e, fnc_0x3f,
fnc_0x40, fnc_0x41, fnc_0x42, fnc_0x43, fnc_0x44, fnc_0x45, fnc_0x46, fnc_0x47,
fnc_0x48, fnc_0x49, fnc_0x4a, fnc_0x4b, fnc_0x4c, fnc_0x4d, fnc_0x4e, fnc_0x4f,
fnc_0x50, fnc_0x51, fnc_0x52, fnc_0x53, fnc_0x54, fnc_0x55, fnc_0x56, fnc_0x57,
fnc_0x58, fnc_0x59, fnc_0x5a, fnc_0x5b, fnc_0x5c, fnc_0x5d, fnc_0x5e, fnc_0x5f,
fnc_0x60, fnc_0x61, fnc_0x62, fnc_0x63, fnc_0x64, fnc_0x65, fnc_0x66, fnc_0x67,
fnc_0x68, fnc_0x69, fnc_0x6a, fnc_0x6b, fnc_0x6c, fnc_0x6d, fnc_0x6e, fnc_0x6f,
fnc_0x70, fnc_0x71, fnc_0x72, fnc_0x73, fnc_0x74, fnc_0x75, fnc_0x76, fnc_0x77,
fnc_0x78, fnc_0x79, fnc_0x7a, fnc_0x7b, fnc_0x7c, fnc_0x7d, fnc_0x7e, fnc_0x7f,
fnc_0x80, fnc_0x81, fnc_0x82, fnc_0x83, fnc_0x84, fnc_0x85, fnc_0x86, fnc_0x87,
fnc_0x88, fnc_0x89, fnc_0x8a, fnc_0x8b, fnc_0x8c, fnc_0x8d, fnc_0x8e, fnc_0x8f,
fnc_0x90, fnc_0x91, fnc_0x92, fnc_0x93, fnc_0x94, fnc_0x95, fnc_0x96, fnc_0x97,
fnc_0x98, fnc_0x99, fnc_0x9a, fnc_0x9b, fnc_0x9c, fnc_0x9d, fnc_0x9e, fnc_0x9f,
fnc_0xa0, fnc_0xa1, fnc_0xa2, fnc_0xa3, fnc_0xa4, fnc_0xa5, fnc_0xa6, fnc_0xa7,
fnc_0xa8, fnc_0xa9, fnc_0xaa, fnc_0xab, fnc_0xac, fnc_0xad, fnc_0xae, fnc_0xaf,
fnc_0xb0, fnc_0xb1, fnc_0xb2, fnc_0xb3, fnc_0xb4, fnc_0xb5, fnc_0xb6, fnc_0xb7,
fnc_0xb8, fnc_0xb9, fnc_0xba, fnc_0xbb, fnc_0xbc, fnc_0xbd, fnc_0xbe, fnc_0xbf,
fnc_0xc0, fnc_0xc1, fnc_0xc2, fnc_0xc3, fnc_0xc4, fnc_0xc5, fnc_0xc6, fnc_0xc7,
fnc_0xc8, fnc_0xc9, fnc_0xca, fnc_0xcb, fnc_0xcc, fnc_0xcd, fnc_0xce, fnc_0xcf,
fnc_0xd0, fnc_0xd1, fnc_0xd2, fnc_0xd3, fnc_0xd4, fnc_0xd5, fnc_0xd6, fnc_0xd7,
fnc_0xd8, fnc_0xd9, fnc_0xda, fnc_0xdb, fnc_0xdc, fnc_0xdd, fnc_0xde, fnc_0xdf,
fnc_0xe0, fnc_0xe1, fnc_0xe2, fnc_0xe3, fnc_0xe4, fnc_0xe5, fnc_0xe6, fnc_0xe7,
fnc_0xe8, fnc_0xe9, fnc_0xea, fnc_0xeb, fnc_0xec, fnc_0xed, fnc_0xee, fnc_0xef,
fnc_0xf0, fnc_0xf1, fnc_0xf2, fnc_0xf3, fnc_0xf4, fnc_0xf5, fnc_0xf6, fnc_0xf7,
fnc_0xf8, fnc_0xf9, fnc_0xfa, fnc_0xfb, fnc_0xfc, fnc_0xfd, fnc_0xfe, fnc_0xff,
};
static void (*z80edops[])(void) = {
fnc_0xed40, fnc_0xed41, fnc_0xed42, fnc_0xed43, fnc_0xed44, fnc_0xed45, fnc_0xed46, fnc_0xed47, // 0x40
fnc_0xed48, fnc_0xed49, fnc_0xed4a, fnc_0xed4b, fnc_0xedXX, fnc_0xedXX, fnc_0xed4d, fnc_0xed4f,
fnc_0xed50, fnc_0xed51, fnc_0xed52, fnc_0xed53, fnc_0xedXX, fnc_0xedXX, fnc_0xed56, fnc_0xed57, // 0x50
fnc_0xed58, fnc_0xed59, fnc_0xed5a, fnc_0xed5b, fnc_0xedXX, fnc_0xedXX, fnc_0xed5e, fnc_0xed5f,
fnc_0xed60, fnc_0xed61, fnc_0xed62, fnc_0xed63, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xed67, // 0x60
fnc_0xed68, fnc_0xed69, fnc_0xed6a, fnc_0xed6b, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xed6f,
fnc_0xedXX, fnc_0xedXX, fnc_0xed72, fnc_0xed73, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, // 0x70
fnc_0xed78, fnc_0xed79, fnc_0xed7a, fnc_0xed7b, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX,
fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, // 0x80
fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX,
fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, // 0x90
fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX,
fnc_0xeda0, fnc_0xeda1, fnc_0xeda2, fnc_0xeda3, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, // 0xa0
fnc_0xeda8, fnc_0xeda9, fnc_0xedaa, fnc_0xedab, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX,
fnc_0xedb0, fnc_0xedb1, fnc_0xedb2, fnc_0xedb3, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, // 0xb0
fnc_0xedb8, fnc_0xedb9, fnc_0xedba, fnc_0xedbb, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX, fnc_0xedXX,
};
static void (*z80rstops[])(void) = {
fnc_0xc7, fnc_0xcf, // RST 0/RST 8
fnc_0xd7, fnc_0xdf, // RST 10/RST 18
fnc_0xe7, fnc_0xef, // RST 20/RST 28
fnc_0xf7, fnc_0xff, // RST 30/RST 38
};
static const unsigned char paritytable[256] = {
4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4,
0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0,
0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0,
4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4,
0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0,
4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4,
4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4,
0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0,
0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0,
4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4,
4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4,
0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0,
4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4,
0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0,
0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0,
4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4
};
extern unsigned char fetch(unsigned short adr);
extern void store(unsigned short adr, unsigned char val);
extern void store2b(unsigned short adr, unsigned char vh, unsigned char vl);
extern unsigned char in(unsigned char dummy, unsigned short adr);
extern unsigned int out(unsigned char dummy, unsigned char adr, unsigned char val);
int cpu_reset; // was reseted by functionkey11
int cpu_int; // normal interrupt appear by functionkey1 - 1
int cpu_intn; // interrupt RST instruction number 0-7
int cpu_nmi; // none maskable interrupt appera by keybord functionkey12
static unsigned char a, f, b, c, d, e, h, l;
static unsigned char r, a1, f1, b1, c1, d1, e1, h1, l1, i, iff1, iff2, im;
static unsigned short pc;
static unsigned short ix, iy, sp;
static unsigned int radjust;
static unsigned char ixoriy, new_ixoriy;
static unsigned char op;
static unsigned int in_halt;
static unsigned short tstates;
#define bc ((b<<8)|c)
#define de ((d<<8)|e)
#define hl ((h<<8)|l)
#define fetch2(x) ((fetch((x)+1)<<8)|fetch(x))
#define store2(x,y) store2b(x,(y)>>8,(y)&255)
#define parity(a) (paritytable[a])
/*============================================================================================
cpu reset function
============================================================================================*/
void z80reset(void) {
a = f = b = c = d = e = h = l = a1 = f1 = b1 = c1 = d1 = e1 = h1 = l1 = i = r = iff1 = iff2 = im = 0;
ix = iy = sp = pc = 0;
tstates = radjust = 0;
cpu_reset = cpu_nmi = cpu_int = 0;
ixoriy = new_ixoriy = 0;
in_halt = 0;
// Z80 2.5MHz CPU clock
//TMR5 = 0;
//PR5 = 0xffff;
//T5CON = 0x8050;
}
void debug() {
Serial.println("");
Serial.println("CPU :");
Serial.printf (" PC : %04X SP : %04X\n", pc, sp);
Serial.printf (" AF : %02X%02X BC : %02X%02X\n", a, f, b, c);
Serial.printf (" DE : %02X%02X HL : %02X%02X\n", d, e, h, l);
Serial.printf ("'AF : %02X%02X 'BC : %02X%02X\n", a1, f1, b1, c1);
Serial.printf ("'DE : %02X%02X 'HL : %02X%02X\n", d1, e1, h1, l1);
Serial.printf (" IX : %04X IY : %04X\n", ix, iy);
}
/*============================================================================================
z80 cpu instruction emulate loop
============================================================================================*/
void execZ80(void) {
//debug();
//unsigned short start;
//while(1){
//start = TMR5;
// NMI appear
// call 0x0066
if (cpu_nmi) {
tstates = 15;
cpu_nmi = 0;
iff2 = iff1;
iff1 = 0; // set DI
sp -= 2;
store2(sp, (pc + 2));
pc = 0x0066;
return;
}
// INT appear, if EI?
if (cpu_int) {
cpu_int = 0;
if (iff1) {
switch (im) {
case 0: // mode 0, execute RST 00-38
(*z80rstops[cpu_intn])();
break;
case 2: // mode 1, execute RST 38H
fnc_0xff();
break;
case 3: // mode 2
tstates = 11;
sp -= 2;
store2(sp, (pc + 2));
pc = (i << 8) + cpu_intn; // ?????
break;
} // switch
} // if
return;
}
// was reseted
if(cpu_reset){
Serial.println("Z80: Reset");
}
// in halt ?
if (in_halt) return;
// fetch and execute next instruction
tstates = 0;
op = fetch(pc); pc++;
(*z80ops[op])();
// ixoriy: =0 HL, =1 IX, =2 IY
ixoriy = new_ixoriy;
new_ixoriy = 0;
// wait instruction cycle
//while(TMR5 - start < tstates);
//}
}
/*============================================================================================
cpu instruction operation code
============================================================================================*/
void fnc_0x00(void)
{
// NOP
tstates += 4;
}
void fnc_0x01(void)
{
// LD BC,nn
tstates += 10;
c = fetch(pc), pc++;
b = fetch(pc), pc++;
}
void fnc_0x02(void)
{
// LD (BC),A
tstates += 7;
store(bc, a);
}
void fnc_0x03(void)
{
// INC BC
tstates += 6;
if (!++c)b++;
}
void fnc_0x04(void)
{
// INC B
tstates += 4;
b++;
f = (f & 1) | (b & 0xa8) | ((!(b & 15)) << 4) | ((!b) << 6) | ((b == 128) << 2);
}
void fnc_0x05(void)
{
// DEC B
tstates += 4;
f = (f & 1) | ((!(b & 15)) << 4) | 2;
--b;
f |= (b & 0xa8) | ((b == 127) << 2) | ((!b) << 6);
}
void fnc_0x06(void)
{
// LD B,n
tstates += 7;
b = fetch(pc);
pc++;
}
void fnc_0x07(void)
{
// RLCA
tstates += 4;
a = (a << 1) | (a >> 7);
f = (f & 0xc4) | (a & 0x29);
}
void fnc_0x08(void)
{
// EX AF,AF'
unsigned char t;
tstates += 4;
t = a; a = a1; a1 = t;
t = f; f = f1; f1 = t;
}
void fnc_0x09(void)
{
// ADD HL,BC
// ADD IX,BC (0xdd09)
// ADD IY,BC (0xfd09)
tstates += 11;
if (!ixoriy) {
unsigned short t;
l = t = l + (c);
f = (f & 0xc4) | (((t >>= 8) + (h & 0x0f) + ((b) & 0x0f) > 15) << 4);
h = t += h + (b);
f |= (h & 0x28) | (t >> 8);
} else {
unsigned long t;
t = (ixoriy == 1 ? ix : iy);
f = (f & 0xc4) | (((t & 0xfff) + ((b << 8) | c) > 0xfff) << 4);
t += (b << 8) | c;
if (ixoriy == 1)ix = t; else iy = t;
f |= ((t >> 8) & 0x28) | (t >> 16);
}
}
void fnc_0x0a(void)
{
// LD A,(BC)
tstates += 7;
a = fetch(bc);
}
void fnc_0x0b(void)
{
// DEC BC
tstates += 6;
if (!c--)b--;
}
void fnc_0x0c(void)
{
// INC C
tstates += 4;
c++;
f = (f & 1) | (c & 0xa8) | ((!(c & 15)) << 4) | ((!c) << 6) | ((c == 128) << 2);
}
void fnc_0x0d(void)
{
// DEC C
tstates += 4;
f = (f & 1) | ((!(c & 15)) << 4) | 2;
--c;
f |= (c & 0xa8) | ((c == 127) << 2) | ((!c) << 6);
}
void fnc_0x0e(void)
{
// LD C,n
tstates += 4;
c = fetch(pc);
pc++;
}
void fnc_0x0f(void)
{
// RRCA
tstates += 4;
f = (f & 0xc4) | (a & 1);
a = (a >> 1) | (a << 7);
f |= a & 0x28;
}
void fnc_0x10(void)
{
// DJNZ (PC+e)
tstates += 8;
if (!--b) {
pc++;
} else {
int j;
j = (signed char)fetch(pc);
pc += j + 1;
tstates += 5;
}
}
void fnc_0x11(void)
{
// LD DE,nn
tstates += 10;
e = fetch(pc); pc++;
d = fetch(pc); pc++;
}
void fnc_0x12(void)
{
// LD (DE),A
tstates += 7;
store(de, a);
}
void fnc_0x13(void)
{
// INC DE
tstates += 6;
if (!++e)d++;
}
void fnc_0x14(void)
{
// INC D
tstates += 4;
d++;
f = (f & 1) | (d & 0xa8) | ((!(d & 15)) << 4) | ((!d) << 6) | ((d == 128) << 2);
}
void fnc_0x15(void)
{
// DEC D
tstates += 4;
f = (f & 1) | ((!(d & 15)) << 4) | 2;
--d;
f |= (d & 0xa8) | ((d == 127) << 2) | ((!d) << 6);
}
void fnc_0x16(void)
{
// LD D,n
tstates += 7;
d = fetch(pc); pc++;
}
void fnc_0x17(void)
{
// RLA
int t;
tstates += 4;
t = a >> 7;
a = (a << 1) | (f & 1);
f = (f & 0xc4) | (a & 0x28) | t;
}
void fnc_0x18(void)
{
// JR (PC+e)
int j;
tstates += 7;
j = (signed char)fetch(pc);
pc += j + 1;
tstates += 5;
}
void fnc_0x19(void)
{
// ADD HL,DE
// ADD IX,DE (0xdd19)
// ADD IY,DE (0xfd19)
tstates += 11;
if (!ixoriy) {
unsigned short t;
l = t = l + e;
f = (f & 0xc4) | (((t >>= 8) + (h & 0x0f) + ((d) & 0x0f) > 15) << 4);
h = t += h + (d);
f |= (h & 0x28) | (t >> 8);
} else {
unsigned long t = (ixoriy == 1 ? ix : iy);
f = (f & 0xc4) | (((t & 0xfff) + ((d << 8) | e) > 0xfff) << 4);
t += (d << 8) | e;
if (ixoriy == 1)ix = t; else iy = t;
f |= ((t >> 8) & 0x28) | (t >> 16);
}
}
void fnc_0x1a(void)
{
// LD A,(DE)
tstates += 7;
a = fetch(de);
}
void fnc_0x1b(void)
{
// DEC DE
tstates += 6;
if (!e--)d--;
}
void fnc_0x1c(void)
{
// INC E
tstates += 4;
e++;
f = (f & 1) | (e & 0xa8) | ((!(e & 15)) << 4) | ((!e) << 6) | ((e == 128) << 2);
}
void fnc_0x1d(void)
{
// DEC E
tstates += 4;
f = (f & 1) | ((!(e & 15)) << 4) | 2;
--e;
f |= (e & 0xa8) | ((e == 127) << 2) | ((!e) << 6);
}
void fnc_0x1e(void)
{
// LD E,nn
tstates += 4;
e = fetch(pc), pc++;
}
void fnc_0x1f(void)
{
// RRA
int t;
tstates += 4;
t = a & 1;
a = (a >> 1) | (f << 7);
f = (f & 0xc4) | (a & 0x28) | t;
}
void fnc_0x20(void)
{
// JR NZ,(PC+e)
tstates += 7;
if (f & 0x40) {
pc++;
} else {
int j = (signed char)fetch(pc);
pc += j + 1;
tstates += 5;
}
}
void fnc_0x21(void)
{
// LD HL,nn
// LD IX,nn (0xdd21)
// LD IY,nn (0xfd21)
tstates += 10;
if (!ixoriy) {
l = fetch(pc), pc++;
h = fetch(pc), pc++;
} else {
if (ixoriy == 1) {
ix = fetch2(pc);
} else {
iy = fetch2(pc);
}
pc += 2;
}
}
void fnc_0x22(void)
{
// LD (nn),HL
// LD (nn),IX (0xdd22)
// LD (nn),IY (0xfd22)
unsigned short addr;
tstates += 16;
addr = fetch2(pc);
pc += 2;
if (!ixoriy) {
store2b(addr, h, l);
} else if (ixoriy == 1) {
store2(addr, ix);
} else {
store2(addr, iy);
}
}
void fnc_0x23(void)
{
// INC HL
// INC IX (0xdd23)
// INC IY (0xfd23)
tstates += 6;
if (!ixoriy) {
if (!++l)h++;
} else if (ixoriy == 1) {
ix++;
} else {
iy++;
}
}
void fnc_0x24(void)
{
// INC H
tstates += 4;
h++;
f = (f & 1) | (h & 0xa8) | ((!(h & 15)) << 4) | ((!h) << 6) | ((h == 128) << 2);
}
void fnc_0x25(void)
{
// DEC H
tstates += 4;
f = (f & 1) | ((!(h & 15)) << 4) | 2;
--h;
f |= (h & 0xa8) | ((h == 127) << 2) | ((!h) << 6);
}
void fnc_0x26(void)
{
// LD H,n
tstates += 7;
h = fetch(pc);
pc++;
}
void fnc_0x27(void)
{
// DAA
unsigned char incr, carry;
unsigned short y;
unsigned char z;
tstates += 4;
incr = 0, carry = (f & 1);
if ((f & 0x10) || (a & 0x0f) > 9)incr = 6;
if ((f & 1) || (a >> 4) > 9)incr |= 0x60;
if (f & 2) {
z = (incr);
y = (a - z - (0)) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f) + (0)) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2;
f |= (!(a = y)) << 6;
} else {
if (a > 0x90 && (a & 15) > 9)incr |= 0x60;
z = (incr);
y = a + z + (0);
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) + (z & 0x0f) + (0) > 15) << 4) | (((~a ^ z) & 0x80 & (y ^ a)) >> 5);
f |= (!(a = y)) << 6;
}
f = ((f | carry) & 0xfb) | parity(a);
}
void fnc_0x28(void)
{
// JR Z,(PC+e)
tstates += 7;
if (f & 0x40) {
int j = (signed char)fetch(pc);
pc += j + 1;
tstates += 5;
} else {
pc++;
}
}
void fnc_0x29(void)
{
// ADD HL,HL
// ADD IX,IX (0xdd29)
// ADD IY,IY (0xfd29)
tstates += 11;
if (!ixoriy) {
unsigned short t;
l = t = l + (l);
f = (f & 0xc4) | (((t >>= 8) + (h & 0x0f) + ((h) & 0x0f) > 15) << 4);
h = t += h + (h);
f |= (h & 0x28) | (t >> 8);
} else if (ixoriy == 1) {
unsigned long t = ix;
f = (f & 0xc4) | (((t & 0xfff) + (((ix >> 8) << 8) | (ix & 0xff)) > 0xfff) << 4);
t += ((ix >> 8) << 8) | (ix & 0xff);
ix = t;
f |= ((t >> 8) & 0x28) | (t >> 16);
} else {
unsigned long t = iy;
f = (f & 0xc4) | (((t & 0xfff) + (((iy >> 8) << 8) | (iy & 0xff)) > 0xfff) << 4);
t += ((iy >> 8) << 8) | (iy & 0xff);
iy = t;
f |= ((t >> 8) & 0x28) | (t >> 16);
}
}
void fnc_0x2a(void)
{
// LD HL,(nn)
// LD IX,(nn) (0xdd2a)
// LD IY,(nn) (0xfd2a)
unsigned short addr;
tstates += 16;
addr = fetch2(pc);
pc += 2;
if (!ixoriy) {
l = fetch(addr);
h = fetch(addr + 1);
} else if (ixoriy == 1) {
ix = fetch2(addr);
} else {
iy = fetch2(addr);
}
}
void fnc_0x2b(void)
{
// DEC HL
// DEC IX (0xdd2b)
// DEC IY (0xfd2b)
tstates += 6;
if (!ixoriy) {
if (!l--)h--;
} else if (ixoriy == 1) {
ix--;
} else {
iy--;
}
}
void fnc_0x2c(void)
{
// INC L
unsigned char t;
tstates += 4;
l++;
f = (f & 1) | (l & 0xa8) | ((!(l & 15)) << 4) | ((!l) << 6) | ((l == 128) << 2);
}
void fnc_0x2d(void)
{
// DEC L
unsigned char t;
tstates += 4;
f = (f & 1) | ((!(l & 15)) << 4) | 2;
--l;
f |= (l & 0xa8) | ((l == 127) << 2) | ((!l) << 6);
}
void fnc_0x2e(void)
{
// LD L,n
tstates += 4;
l = fetch(pc);
pc++;
}
void fnc_0x2f(void)
{
// CPL
tstates += 4;
a = ~a;
f = (f & 0xc5) | (a & 0x28) | 0x12;
}
void fnc_0x30(void)
{
// JR NC,(PC+e)
tstates += 7;
if (f & 1) {
pc++;
} else {
int j = (signed char)fetch(pc);
pc += j + 1;
tstates += 5;
}
}
void fnc_0x31(void)
{
// LD SP,nn
tstates += 10;
sp = fetch2(pc);
pc += 2;
}
void fnc_0x32(void)
{
// LD (nn),A
unsigned short addr;
tstates += 13;
addr = fetch2(pc);
pc += 2;
store(addr, a);
}
void fnc_0x33(void)
{
// INC SP
tstates += 6;
sp++;
}
void fnc_0x34(void)
{
// INC (HL)
// INC (IX+e) (0xdd34)
// INC (IY+e) (0xfd34)
unsigned short addr;
unsigned char t;
tstates += 11;
if (ixoriy == 0) {
addr = hl;
} else {
tstates += 8;
addr = (ixoriy == 1 ? ix : iy) + (signed char)fetch(pc);
pc++;
}
t = fetch(addr);
t++;
f = (f & 1) | (t & 0xa8) | ((!(t & 15)) << 4) | ((!t) << 6) | ((t == 128) << 2);
store(addr, t);
}
void fnc_0x35(void)
{
// DEC (HL)
// DEC (IX+e) (0xdd35)
// DEC (IY+e) (0xfd35)
unsigned short addr;
unsigned char t;
tstates += 11;
if (ixoriy == 0) {
addr = hl;
} else {
tstates += 8;
addr = (ixoriy == 1 ? ix : iy) + (signed char)fetch(pc);
pc++;
}
t = fetch(addr);
f = (f & 1) | ((!(t & 15)) << 4) | 2;
--t;
f |= (t & 0xa8) | ((t == 127) << 2) | ((!t) << 6);
store(addr, t);
}
void fnc_0x36(void)
{
// LD (HL),n
// LD (IX+e),n (0xdd36)
// LD (IY+e),n (0xfd36)
unsigned short addr;
tstates += 10;
if (ixoriy == 0) {
addr = hl;
} else {
tstates += 5;
addr = (ixoriy == 1 ? ix : iy) + (signed char)fetch(pc);
pc++;
}
store(addr, fetch(pc));
pc++;
}
void fnc_0x37(void)
{
// SCF
tstates += 4;
f = (f & 0xc4) | 1 | (a & 0x28);
}
void fnc_0x38(void)
{
// JR C,(PC+e)
tstates += 7;
if (f & 1) {
int j = (signed char)fetch(pc);
pc += j + 1;
tstates += 5;
} else {
pc++;
}
}
void fnc_0x39(void)
{
// ADD HL,SP
// ADD IX,SP (0xdd39)
// ADD IY,SP (0xfd39)
tstates += 11;
if (!ixoriy) {
unsigned short t;
l = t = l + ((sp & 0xff));
f = (f & 0xc4) | (((t >>= 8) + (h & 0x0f) + (((sp >> 8)) & 0x0f) > 15) << 4);
h = t += h + ((sp >> 8));
f |= (h & 0x28) | (t >> 8);
} else {
unsigned long t = (ixoriy == 1 ? ix : iy);
f = (f & 0xc4) | (((t & 0xfff) + (((sp >> 8) << 8) | (sp & 0xff)) > 0xfff) << 4);
t += ((sp >> 8) << 8) | (sp & 0xff);
if (ixoriy == 1) {
ix = t;
} else {
iy = t;
}
f |= ((t >> 8) & 0x28) | (t >> 16);
}
}
void fnc_0x3a(void)
{
// LD A,(nn)
unsigned short addr;
tstates += 13;
addr = fetch2(pc);
pc += 2;
a = fetch(addr);
}
void fnc_0x3b(void)
{
// DEC SP
tstates += 6;
sp--;
}
void fnc_0x3c(void)
{
// INC A
tstates += 4;
a++;
f = (f & 1) | (a & 0xa8) | ((!(a & 15)) << 4) | ((!a) << 6) | ((a == 128) << 2);
}
void fnc_0x3d(void)
{
// DEC A
tstates += 4;
f = (f & 1) | ((!(a & 15)) << 4) | 2, --a, f |= (a & 0xa8) | ((a == 127) << 2) | ((!a) << 6);
}
void fnc_0x3e(void)
{
// LD A,n
tstates += 4;
a = fetch(pc); pc++;
}
void fnc_0x3f(void)
{
// CCF
tstates += 4;
f = (f & 0xc4) | ((f & 1) ^ 1) | ((f & 1) << 4) | (a & 0x28);
}
void fnc_0x40(void)
{
// LD B,B
tstates += 4;
}
void fnc_0x41(void)
{
// LD B,C
tstates += 4;
b = c;
}
void fnc_0x42(void)
{
// LD B,D
tstates += 4;
b = d;
}
void fnc_0x43(void)
{
// LD B,E
tstates += 4;
b = e;
}
void fnc_0x44(void)
{
// LD B,H
tstates += 4;
b = h;
}
void fnc_0x45(void)
{
// LD B,L
tstates += 4;
b = l;
}
void fnc_0x46(void)
{
// LD B,(HL)
// LD B,(IX+e) (0xdd46)
// LD B,(IY+e) (0xfd46)
unsigned short addr;
tstates += 7;
if (ixoriy == 0) {
addr = hl;
} else {
tstates += 8;
addr = (ixoriy == 1 ? ix : iy) + (signed char)fetch(pc);
pc++;
}
b = fetch(addr);
}
void fnc_0x47(void)
{
// LD B,A
tstates += 4;
b = a;
}
void fnc_0x48(void)
{
// LD C,B
tstates += 4;
c = b;
}
void fnc_0x49(void)
{
// LD C,C
tstates += 4;
}
void fnc_0x4a(void)
{
// LD C,D
tstates += 4;
c = d;
}
void fnc_0x4b(void)
{
// LD C,E
tstates += 4;
c = e;
}
void fnc_0x4c(void)
{
// LD C,H
tstates += 4;
c = h;
}
void fnc_0x4d(void)
{
// LD C,L
tstates += 4;
c = l;
}
void fnc_0x4e(void)
{
// LD C,(HL)
// LD C,(IX+e) (0xdd4e)
// LD C,(IY+e) (0xfd4e)
unsigned short addr;
tstates += 7;
if (ixoriy == 0) {
addr = hl;
} else {
tstates += 8;
addr = (ixoriy == 1 ? ix : iy) + (signed char)fetch(pc);
pc++;
}
c = fetch(addr);
}
void fnc_0x4f(void)
{
// LD C,A
tstates += 4;
c = a;
}
void fnc_0x50(void)
{
// LD D,B
tstates += 4;
d = b;
}
void fnc_0x51(void)
{
// LD D,C
tstates += 4;
d = c;
}
void fnc_0x52(void)
{
// LD D,D
tstates += 4;
}
void fnc_0x53(void)
{
// LD D,E
tstates += 4;
d = e;
}
void fnc_0x54(void)
{
// LD D,H
tstates += 4;
d = h;
}
void fnc_0x55(void)
{
// LD D,L
tstates += 4;
d = l;
}
void fnc_0x56(void)
{
// LD D,(HL)
// LD D,(IX+e) (0xdd56)
// LD D,(IY+e) (0xfd56)
unsigned short addr;
tstates += 7;
if (ixoriy == 0) {
addr = hl;
} else {
tstates += 8;
addr = (ixoriy == 1 ? ix : iy) + (signed char)fetch(pc);
pc++;
}
d = fetch(addr);
}
void fnc_0x57(void)
{
// LD D,A
tstates += 4;
d = a;
}
void fnc_0x58(void)
{
// LD E,B
tstates += 4;
e = b;
}
void fnc_0x59(void)
{
// LD E,C
tstates += 4;
e = c;
}
void fnc_0x5a(void)
{
// LD E,D
tstates += 4;
e = d;
}
void fnc_0x5b(void)
{
// LD E,E
tstates += 4;
}
void fnc_0x5c(void)
{
// LD E,H
tstates += 4;
e = h;
}
void fnc_0x5d(void)
{
// LD E,L
tstates += 4;
e = l;
}
void fnc_0x5e(void)
{
// LD E,(HL)
// LD E,(IX+e) (0xdd5e)
// LD E,(IY+e) (0xfd5e)
unsigned short addr;
tstates += 7;
if (ixoriy == 0) {
addr = hl;
} else {
tstates += 8;
addr = (ixoriy == 1 ? ix : iy) + (signed char)fetch(pc);
pc++;
}
e = fetch(addr);
}
void fnc_0x5f(void)
{
// LD E,A
tstates += 4;
e = a;
}
void fnc_0x60(void)
{
// LD H,B
tstates += 4;
h = b;
}
void fnc_0x61(void)
{
// LD H,C
tstates += 4;
h = c;
}
void fnc_0x62(void)
{
// LD H,D
tstates += 4;
h = d;
}
void fnc_0x63(void)
{
// LD H,E
tstates += 4;
h = e;
}
void fnc_0x64(void)
{
// LD H,H
tstates += 4;
}
void fnc_0x65(void)
{
// LD H,L
tstates += 4;
h = l;
}
void fnc_0x66(void)
{
//�@LD H,(HL)
// LD H,(IX+e) (0xdd66)
// LD H,(IY+e) (0xfd66)
unsigned short addr;
tstates += 7;
if (ixoriy == 0) {
addr = hl;
} else {
tstates += 8;
addr = (ixoriy == 1 ? ix : iy) + (signed char)fetch(pc);
pc++;
}
h = fetch(addr);
}
void fnc_0x67(void)
{
// LD H,A
tstates += 4;
h = a;
}
void fnc_0x68(void)
{
// LD L,B
tstates += 4;
l = b;
}
void fnc_0x69(void)
{
// LD L,C
tstates += 4;
l = c;
}
void fnc_0x6a(void)
{
// LD L,D
tstates += 4;
l = d;
}
void fnc_0x6b(void)
{
// LD L,E
tstates += 4;
l = e;
}
void fnc_0x6c(void)
{
// LD L,H
tstates += 4;
l = h;
}
void fnc_0x6d(void)
{
// LD L,L
tstates += 4;
}
void fnc_0x6e(void)
{
// LD L,(HL)
// LD L,(IX+e) (0xdd6e)
// LD L,(IY+e) (0xfd6e)
unsigned short addr;
tstates += 7;
if (ixoriy == 0) {
addr = hl;
} else {
tstates += 8;
addr = (ixoriy == 1 ? ix : iy) + (signed char)fetch(pc);
pc++;
}
l = fetch(addr);
}
void fnc_0x6f(void)
{
// LD L,A
tstates += 4;
l = a;
}
void fnc_0x70(void)
{
// LD (HL),B
// LD (IX+e),B (0xdd70)
// LD (IY+e),B (0xfd70)
unsigned short addr;
tstates += 7;
if (ixoriy == 0) {
addr = hl;
} else {
tstates += 8;
addr = (ixoriy == 1 ? ix : iy) + (signed char)fetch(pc);
pc++;
}
store(addr, b);
}
void fnc_0x71(void)
{
// LD (HL),C
// LD (IX+e),C (0xdd71)
// LD (IY+e),C (0xfd71)
unsigned short addr;
tstates += 7;
if (ixoriy == 0) {
addr = hl;
} else {
tstates += 8;
addr = (ixoriy == 1 ? ix : iy) + (signed char)fetch(pc);
pc++;
}
store(addr, c);
}
void fnc_0x72(void)
{
// LD (HL),D
// LD (IX+e),D (0xdd72)
// LD (IY+e),D (0xfd72)
unsigned short addr;
tstates += 7;
if (ixoriy == 0) {
addr = hl;
} else {
tstates += 8;
addr = (ixoriy == 1 ? ix : iy) + (signed char)fetch(pc);
pc++;
}
store(addr, d);
}
void fnc_0x73(void)
{
// LD (HL),E
// LD (IX+e),E (0xdd73)
// LD (IY+e),E (0xfd73)
unsigned short addr;
tstates += 7;
if (ixoriy == 0) {
addr = hl;
} else {
tstates += 8;
addr = (ixoriy == 1 ? ix : iy) + (signed char)fetch(pc);
pc++;
}
store(addr, e);
}
void fnc_0x74(void)
{
// LD (HL),H
// LD (IX+e),H (0xdd74)
// LD (IY+e),H (0xfd74)
unsigned short addr;
tstates += 7;
if (ixoriy == 0) {
addr = hl;
} else {
tstates += 8;
addr = (ixoriy == 1 ? ix : iy) + (signed char)fetch(pc);
pc++;
}
store(addr, h);
}
void fnc_0x75(void)
{
// LD (HL),L
// LD (IX+e),L (0xdd75)
// LD (IY+e),L (0xfd75)
unsigned short addr;
tstates += 7;
if (ixoriy == 0) {
addr = hl;
} else {
tstates += 8;
addr = (ixoriy == 1 ? ix : iy) + (signed char)fetch(pc);
pc++;
}
store(addr, l);
}
void fnc_0x76(void) /* HALT */
{
tstates += 4;
in_halt = 1;
}
void fnc_0x77(void)
{
// LD (HL),A
// LD (IX+e),A (0xdd77)
// LD (IY+e),A (0xfd77)
unsigned short addr;
tstates += 7;
if (ixoriy == 0) {
addr = hl;
} else {
tstates += 8;
addr = (ixoriy == 1 ? ix : iy) + (signed char)fetch(pc);
pc++;
}
store(addr, a);
}
void fnc_0x78(void)
{
// LD A,B
tstates += 4;
a = b;
}
void fnc_0x79(void)
{
// LD A,C
tstates += 4;
a = c;
}
void fnc_0x7a(void)
{
// LD A,D
tstates += 4;
a = d;
}
void fnc_0x7b(void)
{
// LD A,E
tstates += 4;
a = e;
}
void fnc_0x7c(void)
{
// LD A,H
tstates += 4;
a = h;
}
void fnc_0x7d(void)
{
// LD A,L
tstates += 4;
a = l;
}
void fnc_0x7e(void)
{
// LD A,(HL)
// LD A,(IX+e) (0xdd7e)
// LD A,(IY+e) (0xfd7e)
unsigned short addr;
tstates += 7;
if (ixoriy == 0) {
addr = hl;
} else {
tstates += 8;
addr = (ixoriy == 1 ? ix : iy) + (signed char)fetch(pc);
pc++;
}
a = fetch(addr);
}
void fnc_0x7f(void)
{
// LD A,A
tstates += 4;
}
void fnc_0x80(void)
{
// ADD A,B
unsigned short y;
unsigned char z;
tstates += 4;
z = b;
y = a + z + (0);
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) + (z & 0x0f) + (0) > 15) << 4) | (((~a ^ z) & 0x80 & (y ^ a)) >> 5);
f |= (!(a = y)) << 6;
}
void fnc_0x81(void)
{
// ADD A,C
tstates += 4;
unsigned short y;
unsigned char z;
z = c;
y = a + z + (0);
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) + (z & 0x0f) + (0) > 15) << 4) | (((~a ^ z) & 0x80 & (y ^ a)) >> 5);
f |= (!(a = y)) << 6;
}
void fnc_0x82(void)
{
// ADD A,D
tstates += 4;
unsigned short y;
unsigned char z;
z = d;
y = a + z + (0);
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) + (z & 0x0f) + (0) > 15) << 4) | (((~a ^ z) & 0x80 & (y ^ a)) >> 5);
f |= (!(a = y)) << 6;
}
void fnc_0x83(void)
{
// ADD A,E
tstates += 4;
unsigned short y;
unsigned char z;
z = e;
y = a + z + (0);
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) + (z & 0x0f) + (0) > 15) << 4) | (((~a ^ z) & 0x80 & (y ^ a)) >> 5);
f |= (!(a = y)) << 6;
}
void fnc_0x84(void)
{
// ADD A,H
tstates += 4;
unsigned short y;
unsigned char z;
z = h;
y = a + z + (0);
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) + (z & 0x0f) + (0) > 15) << 4) | (((~a ^ z) & 0x80 & (y ^ a)) >> 5);
f |= (!(a = y)) << 6;
}
void fnc_0x85(void)
{
// ADD A,L
tstates += 4;
unsigned short y;
unsigned char z;
z = l;
y = a + z + (0);
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) + (z & 0x0f) + (0) > 15) << 4) | (((~a ^ z) & 0x80 & (y ^ a)) >> 5);
f |= (!(a = y)) << 6;
}
void fnc_0x86(void)
{
// ADD A,(HL)
// ADD A,(IX+e) (0xdd86)
// ADD A,(IY+e) (0xfd86)
unsigned short addr;
unsigned short y;
unsigned char z;
tstates += 7;
if (ixoriy == 0) {
addr = hl;
} else {
tstates += 8;
addr = (ixoriy == 1 ? ix : iy) + (signed char)fetch(pc);
pc++;
}
z = (fetch(addr));
y = a + z + (0);
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) + (z & 0x0f) + (0) > 15) << 4) | (((~a ^ z) & 0x80 & (y ^ a)) >> 5);
f |= (!(a = y)) << 6;
}
void fnc_0x87(void)
{
// ADD A,A
unsigned short y;
unsigned char z = (a);
tstates += 4;
z = a;
y = a + z + (0);
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) + (z & 0x0f) + (0) > 15) << 4) | (((~a ^ z) & 0x80 & (y ^ a)) >> 5);
f |= (!(a = y)) << 6;
}
void fnc_0x88(void)
{
// ADC A,B
unsigned short y;
unsigned char z;
tstates += 4;
z = b;
y = a + z + ((f & 1));
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) + (z & 0x0f) + ((f & 1)) > 15) << 4) | (((~a ^ z) & 0x80 & (y ^ a)) >> 5);
f |= (!(a = y)) << 6;
}
void fnc_0x89(void)
{
// ADC A,C
unsigned short y;
unsigned char z;
tstates += 4;
z = c;
y = a + z + ((f & 1));
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) + (z & 0x0f) + ((f & 1)) > 15) << 4) | (((~a ^ z) & 0x80 & (y ^ a)) >> 5);
f |= (!(a = y)) << 6;
}
void fnc_0x8a(void)
{
// ADC A,D
unsigned short y;
unsigned char z;
tstates += 4;
z = d;
y = a + z + ((f & 1));
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) + (z & 0x0f) + ((f & 1)) > 15) << 4) | (((~a ^ z) & 0x80 & (y ^ a)) >> 5);
f |= (!(a = y)) << 6;
}
void fnc_0x8b(void)
{
// ADC A,E
unsigned short y;
unsigned char z;
tstates += 4;
z = e;
y = a + z + ((f & 1));
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) + (z & 0x0f) + ((f & 1)) > 15) << 4) | (((~a ^ z) & 0x80 & (y ^ a)) >> 5);
f |= (!(a = y)) << 6;
}
void fnc_0x8c(void)
{
// ADC A,H
tstates += 4;
unsigned short y;
unsigned char z;
tstates += 4;
z = h;
y = a + z + ((f & 1));
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) + (z & 0x0f) + ((f & 1)) > 15) << 4) | (((~a ^ z) & 0x80 & (y ^ a)) >> 5);
f |= (!(a = y)) << 6;
}
void fnc_0x8d(void)
{
// ADC A,L
tstates += 4;
unsigned short y;
unsigned char z;
tstates += 4;
z = l;
y = a + z + ((f & 1));
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) + (z & 0x0f) + ((f & 1)) > 15) << 4) | (((~a ^ z) & 0x80 & (y ^ a)) >> 5);
f |= (!(a = y)) << 6;
}
void fnc_0x8e(void)
{
// ADC A,(HL)
// ADC A,(IX+e) 0xdd8e
// ADC A,(IY+e) 0xfd8e
unsigned short addr;
unsigned short y;
unsigned char z;
tstates += 7;
if (ixoriy == 0) {
addr = hl;
} else {
tstates += 8;
addr = (ixoriy == 1 ? ix : iy) + (signed char)fetch(pc);
pc++;
}
z = (fetch(addr));
y = a + z + ((f & 1));
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) + (z & 0x0f) + ((f & 1)) > 15) << 4) | (((~a ^ z) & 0x80 & (y ^ a)) >> 5);
f |= (!(a = y)) << 6;
}
void fnc_0x8f(void)
{
// ADC A,A
unsigned short y;
unsigned char z;
tstates += 4;
z = a;
y = a + z + ((f & 1));
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) + (z & 0x0f) + ((f & 1)) > 15) << 4) | (((~a ^ z) & 0x80 & (y ^ a)) >> 5);
f |= (!(a = y)) << 6;
}
void fnc_0x90(void)
{
// SUB B
unsigned short y;
unsigned char z;
tstates += 4;
z = b;
y = (a - z - (0)) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f) + (0)) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2;
f |= (!(a = y)) << 6;
}
void fnc_0x91(void)
{
// SUB C
unsigned short y;
unsigned char z;
tstates += 4;
z = c;
y = (a - z - (0)) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f) + (0)) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2;
f |= (!(a = y)) << 6;
}
void fnc_0x92(void)
{
// SUB D
unsigned short y;
unsigned char z;
tstates += 4;
z = d;
y = (a - z - (0)) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f) + (0)) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2;
f |= (!(a = y)) << 6;
}
void fnc_0x93(void)
{
// SUB E
unsigned short y;
unsigned char z;
tstates += 4;
z = e;
y = (a - z - (0)) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f) + (0)) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2;
f |= (!(a = y)) << 6;
}
void fnc_0x94(void)
{
// SUB H
unsigned short y;
unsigned char z;
tstates += 4;
z = h;
y = (a - z - (0)) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f) + (0)) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2;
f |= (!(a = y)) << 6;
}
void fnc_0x95(void)
{
// SUB L
unsigned short y;
unsigned char z;
tstates += 4;
z = l;
y = (a - z - (0)) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f) + (0)) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2;
f |= (!(a = y)) << 6;
}
void fnc_0x96(void)
{
// SUB (HL)
// SUB (IX+e) 0xdd96
// SUB (IY+e) 0xfd96
unsigned short addr;
unsigned short y;
unsigned char z;
tstates += 7;
if (ixoriy == 0) {
addr = hl;
} else {
tstates += 8;
addr = (ixoriy == 1 ? ix : iy) + (signed char)fetch(pc);
pc++;
}
z = (fetch(addr));
y = (a - z - (0)) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f) + (0)) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2;
f |= (!(a = y)) << 6;
}
void fnc_0x97(void)
{
// SUB A
unsigned short y;
unsigned char z;
tstates += 4;
z = a;
y = (a - z - (0)) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f) + (0)) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2;
f |= (!(a = y)) << 6;
}
void fnc_0x98(void)
{
// SBC B
unsigned short y;
unsigned char z;
tstates += 4;
z = b;
y = (a - z - ((f & 1))) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f) + ((f & 1))) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2;
f |= (!(a = y)) << 6;
}
void fnc_0x99(void)
{
// SBC C
unsigned short y;
unsigned char z;
tstates += 4;
z = c;
y = (a - z - ((f & 1))) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f) + ((f & 1))) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2;
f |= (!(a = y)) << 6;
}
void fnc_0x9a(void)
{
// SBC D
unsigned short y;
unsigned char z;
tstates += 4;
z = d;
y = (a - z - ((f & 1))) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f) + ((f & 1))) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2;
f |= (!(a = y)) << 6;
}
void fnc_0x9b(void)
{
// SBC E
unsigned short y;
unsigned char z;
tstates += 4;
z = e;
y = (a - z - ((f & 1))) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f) + ((f & 1))) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2;
f |= (!(a = y)) << 6;
}
void fnc_0x9c(void)
{
// SBC H
unsigned short y;
unsigned char z;
tstates += 4;
z = h;
y = (a - z - ((f & 1))) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f) + ((f & 1))) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2;
f |= (!(a = y)) << 6;
}
void fnc_0x9d(void)
{
// SBC L
unsigned short y;
unsigned char z;
tstates += 4;
z = l;
y = (a - z - ((f & 1))) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f) + ((f & 1))) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2;
f |= (!(a = y)) << 6;
}
void fnc_0x9e(void)
{
// SBC (HL)
// SBC (IX+e)
// SBC (IY+e)
unsigned short addr;
unsigned short y;
unsigned char z;
tstates += 7;
if (ixoriy == 0) {
addr = hl;
} else {
tstates += 8;
addr = (ixoriy == 1 ? ix : iy) + (signed char)fetch(pc);
pc++;
}
z = (fetch(addr));
y = (a - z - ((f & 1))) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f) + ((f & 1))) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2;
f |= (!(a = y)) << 6;
}
void fnc_0x9f(void)
{
// SBC A
unsigned short y;
unsigned char z;
tstates += 4;
z = a;
y = (a - z - ((f & 1))) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f) + ((f & 1))) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2;
f |= (!(a = y)) << 6;
}
void fnc_0xa0(void)
{
// AND B
tstates += 4;
a &= b;
f = (a & 0xa8) | ((!a) << 6) | 0x10 | parity(a);
}
void fnc_0xa1(void)
{
// AND C
tstates += 4;
a &= c;
f = (a & 0xa8) | ((!a) << 6) | 0x10 | parity(a);
}
void fnc_0xa2(void)
{
// AND D
tstates += 4;
a &= d;
f = (a & 0xa8) | ((!a) << 6) | 0x10 | parity(a);
}
void fnc_0xa3(void)
{
// AND E
tstates += 4;
a &= e;
f = (a & 0xa8) | ((!a) << 6) | 0x10 | parity(a);
}
void fnc_0xa4(void)
{
// AND H
tstates += 4;
a &= h;
f = (a & 0xa8) | ((!a) << 6) | 0x10 | parity(a);
}
void fnc_0xa5(void)
{
// AND L
tstates += 4;
a &= l;
f = (a & 0xa8) | ((!a) << 6) | 0x10 | parity(a);
}
void fnc_0xa6(void)
{
// AND (HL)
// AND (IX+e) 0xdda6
// AND (IY+e) 0xfda6
unsigned short addr;
tstates += 7;
if (ixoriy == 0) {
addr = hl;
} else {
tstates += 8;
addr = (ixoriy == 1 ? ix : iy) + (signed char)fetch(pc);
pc++;
}
a &= (fetch(addr));
f = (a & 0xa8) | ((!a) << 6) | 0x10 | parity(a);
}
void fnc_0xa7(void)
{
// AND A
tstates += 4;
a &= a;
f = (a & 0xa8) | ((!a) << 6) | 0x10 | parity(a);
}
void fnc_0xa8(void)
{
// XOR B
tstates += 4;
a ^= b;
f = (a & 0xa8) | ((!a) << 6) | parity(a);
}
void fnc_0xa9(void)
{
// XOR C
tstates += 4;
a ^= c;
f = (a & 0xa8) | ((!a) << 6) | parity(a);
}
void fnc_0xaa(void)
{
// XOR D
tstates += 4;
a ^= d;
f = (a & 0xa8) | ((!a) << 6) | parity(a);
}
void fnc_0xab(void)
{
// XOR E
tstates += 4;
a ^= e;
f = (a & 0xa8) | ((!a) << 6) | parity(a);
}
void fnc_0xac(void)
{
// XOR H
tstates += 4;
a ^= h;
f = (a & 0xa8) | ((!a) << 6) | parity(a);
}
void fnc_0xad(void)
{
// XOR L
tstates += 4;
a ^= l;
f = (a & 0xa8) | ((!a) << 6) | parity(a);
}
void fnc_0xae(void)
{
// XOR (HL)
// XOR (IX+e) 0xddae
// XOR (IY+e) 0xfdae
unsigned short addr;
tstates += 7;
if (ixoriy == 0) {
addr = hl;
} else {
tstates += 8;
addr = (ixoriy == 1 ? ix : iy) + (signed char)fetch(pc);
pc++;
}
a ^= (fetch(addr));
f = (a & 0xa8) | ((!a) << 6) | parity(a);
}
void fnc_0xaf(void)
{
// XOR A
tstates += 4;
a ^= a;
f = (a & 0xa8) | ((!a) << 6) | parity(a);
}
void fnc_0xb0(void)
{
// OR B
tstates += 4;
a |= b;
f = (a & 0xa8) | ((!a) << 6) | parity(a);
}
void fnc_0xb1(void)
{
// OR C
tstates += 4;
a |= c;
f = (a & 0xa8) | ((!a) << 6) | parity(a);
}
void fnc_0xb2(void)
{
// OR D
tstates += 4;
a |= d;
f = (a & 0xa8) | ((!a) << 6) | parity(a);
}
void fnc_0xb3(void)
{
// OR E
tstates += 4;
a |= e;
f = (a & 0xa8) | ((!a) << 6) | parity(a);
}
void fnc_0xb4(void)
{
// OR H
tstates += 4;
a |= h;
f = (a & 0xa8) | ((!a) << 6) | parity(a);
}
void fnc_0xb5(void)
{
// OR L
tstates += 4;
a |= l;
f = (a & 0xa8) | ((!a) << 6) | parity(a);
}
void fnc_0xb6(void)
{
// OR (HL)
// OR (IX+e)
// OR (IY+e)
unsigned short addr;
tstates += 7;
if (ixoriy == 0) {
addr = hl;
} else {
tstates += 8;
addr = (ixoriy == 1 ? ix : iy) + (signed char)fetch(pc);
pc++;
}
a |= (fetch(addr));
f = (a & 0xa8) | ((!a) << 6) | parity(a);
}
void fnc_0xb7(void)
{
// OR A
tstates += 4;
a |= a;
f = (a & 0xa8) | ((!a) << 6) | parity(a);
}
void fnc_0xb8(void)
{
// CP B
unsigned short y;
unsigned char z;
tstates += 4;
z = b;
y = (a - z) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f)) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2 | ((!y) << 6);
}
void fnc_0xb9(void)
{
// CP C
unsigned short y;
unsigned char z;
tstates += 4;
z = c;
y = (a - z) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f)) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2 | ((!y) << 6);
}
void fnc_0xba(void)
{
// CP D
unsigned short y;
unsigned char z;
tstates += 4;
z = d;
y = (a - z) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f)) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2 | ((!y) << 6);
}
void fnc_0xbb(void)
{
// CP E
unsigned short y;
unsigned char z;
tstates += 4;
z = e;
y = (a - z) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f)) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2 | ((!y) << 6);
}
void fnc_0xbc(void)
{
// CP H
unsigned short y;
unsigned char z;
tstates += 4;
z = h;
y = (a - z) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f)) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2 | ((!y) << 6);
}
void fnc_0xbd(void)
{
// CP L
unsigned short y;
unsigned char z;
tstates += 4;
z = l;
y = (a - z) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f)) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2 | ((!y) << 6);
}
void fnc_0xbe(void)
{
// CP (HL)
// CP (IX+e) 0xddbe
// CP (IY+e) 0xfdbe
unsigned short addr;
unsigned short y;
unsigned char z;
tstates += 7;
if (ixoriy == 0) {
addr = hl;
} else {
tstates += 8;
addr = (ixoriy == 1 ? ix : iy) + (signed char)fetch(pc);
pc++;
}
z = (fetch(addr));
y = (a - z) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f)) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2 | ((!y) << 6);
}
void fnc_0xbf(void)
{
// CP A
unsigned short y;
unsigned char z;
tstates += 4;
z = a;
y = (a - z) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f)) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2 | ((!y) << 6);
}
void fnc_0xc0(void)
{
// RET NZ
tstates += 5;
if (!(f & 0x40)) {
tstates += 6;
pc = fetch2(sp);
sp += 2;
}
}
void fnc_0xc1(void)
{
// POP BC
tstates += 10;
c = fetch(sp);
b = fetch(sp + 1);
sp += 2;
}
void fnc_0xc2(void)
{
// JR NZ,nn
tstates += 10;
if (!(f & 0x40)) {
pc = fetch2(pc);
} else {
pc += 2;
}
}
void fnc_0xc3(void)
{
// JP nn
tstates += 10;
pc = fetch2(pc);
}
void fnc_0xc4(void)
{
// CALL NZ,nn
tstates += 10;
if (!(f & 0x40)) {
tstates += 7;
sp -= 2;
store2(sp, (pc + 2));
pc = fetch2(pc);
} else {
pc += 2;
}
}
void fnc_0xc5(void)
{
// PUSH BC
tstates += 11;
sp -= 2;
store2b(sp, b, c);
}
void fnc_0xc6(void)
{
// ADD A,n
unsigned short y;
unsigned char z;
tstates += 7;
z = (fetch(pc));
y = a + z + (0);
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) + (z & 0x0f) + (0) > 15) << 4) | (((~a ^ z) & 0x80 & (y ^ a)) >> 5);
f |= (!(a = y)) << 6;
pc++;
}
void fnc_0xc7(void)
{
// RST 0
tstates += 11;
sp -= 2;
store2(sp, (pc));
pc = 0;
}
void fnc_0xc8(void)
{
// RET Z
tstates += 5;
if (f & 0x40) {
tstates += 6;
pc = fetch2(sp);
sp += 2;
}
}
void fnc_0xc9(void)
{
// RET
tstates += 10;
pc = fetch2(sp);
sp += 2;
}
void fnc_0xca(void)
{
// JP Z,nn
tstates += 10;
if (f & 0x40) {
pc = fetch2(pc);
} else {
pc += 2;
}
}
void fnc_0xcb(void)
{
unsigned short addr;
unsigned char op, reg, val, t;
tstates += 4;
if (ixoriy) {
addr = (ixoriy == 1 ? ix : iy) + (signed char)fetch(pc);
pc++;
tstates += 8;
op = fetch(pc);
reg = op & 7;
op = (op & 0xf8) | 6;
} else {
op = fetch(pc);
tstates += 4;
radjust++;
addr = hl;
}
pc++;
if (op < 64) {
switch (op) {
case 0: b = (b << 1) | (b >> 7); f = (b & 1) | (b & 0xa8) | ((!b) << 6) | parity(b); break; //RLC B
case 1: c = (c << 1) | (c >> 7); f = (c & 1) | (c & 0xa8) | ((!c) << 6) | parity(c); break; //RLC C
case 2: d = (d << 1) | (d >> 7); f = (d & 1) | (d & 0xa8) | ((!d) << 6) | parity(d); break; //RLC D
case 3: e = (e << 1) | (e >> 7); f = (e & 1) | (e & 0xa8) | ((!e) << 6) | parity(e); break; //RLC E
case 4: h = (h << 1) | (h >> 7); f = (h & 1) | (h & 0xa8) | ((!h) << 6) | parity(h); break; //RLC H
case 5: l = (l << 1) | (l >> 7); f = (l & 1) | (l & 0xa8) | ((!l) << 6) | parity(l); break; //RLC L
case 6: //RLC (HL/IX+e/IY+e)
tstates += 7; val = fetch(addr);
val = (val << 1) | (val >> 7); f = (val & 1) | (val & 0xa8) | ((!val) << 6) | parity(val);
store(addr, val);
break;
case 7: a = (a << 1) | (a >> 7); f = (a & 1) | (a & 0xa8) | ((!a) << 6) | parity(a); break; //RLCA
case 8: t = b & 1; b = (b >> 1) | (t << 7); f = (t) | (b & 0xa8) | ((!b) << 6) | parity(b); break; //RRC B
case 9: t = c & 1; c = (c >> 1) | (t << 7); f = (t) | (c & 0xa8) | ((!c) << 6) | parity(c); break; //RRC C
case 10: t = d & 1; d = (d >> 1) | (t << 7); f = (t) | (d & 0xa8) | ((!d) << 6) | parity(d); break; //RRC D
case 11: t = e & 1; e = (e >> 1) | (t << 7); f = (t) | (e & 0xa8) | ((!e) << 6) | parity(e); break; //RRC E
case 12: t = h & 1; h = (h >> 1) | (t << 7); f = (t) | (h & 0xa8) | ((!h) << 6) | parity(h); break; //RRC H
case 13: t = l & 1; l = (l >> 1) | (t << 7); f = (t) | (l & 0xa8) | ((!l) << 6) | parity(l); break; //RRC L
case 14: //RRC (HL/IX+e/IY+e)
tstates += 7; val = fetch(addr);
t = val & 1; val = (val >> 1) | (t << 7); f = (t) | (val & 0xa8) | ((!val) << 6) | parity(val);
store(addr, val);
break;
case 15: t = a & 1; a = (a >> 1) | (t << 7); f = (t) | (a & 0xa8) | ((!a) << 6) | parity(a); break; //RRCA
case 0x10: t = b >> 7; b = (b << 1) | (f & 1); f = (t) | (b & 0xa8) | ((!b) << 6) | parity(b); break; //RL B
case 0x11: t = c >> 7; c = (c << 1) | (f & 1); f = (t) | (c & 0xa8) | ((!c) << 6) | parity(c); break; //RL C
case 0x12: t = d >> 7; d = (d << 1) | (f & 1); f = (t) | (d & 0xa8) | ((!d) << 6) | parity(d); break; //RL D
case 0x13: t = e >> 7; e = (e << 1) | (f & 1); f = (t) | (e & 0xa8) | ((!e) << 6) | parity(e); break; //RL E
case 0x14: t = h >> 7; h = (h << 1) | (f & 1); f = (t) | (h & 0xa8) | ((!h) << 6) | parity(h); break; //RL H
case 0x15: t = l >> 7; l = (l << 1) | (f & 1); f = (t) | (l & 0xa8) | ((!l) << 6) | parity(l); break; //RL L
case 0x16: //RL (HL/IX+e/IY+e)
tstates += 7; val = fetch(addr);
t = val >> 7; val = (val << 1) | (f & 1); f = (t) | (val & 0xa8) | ((!val) << 6) | parity(val);
store(addr, val);
break;
case 0x17: t = a >> 7; a = (a << 1) | (f & 1); f = (t) | (a & 0xa8) | ((!a) << 6) | parity(a); break; //RLA
case 0x18: t = b & 1; b = (b >> 1) | (f << 7); f = (t) | (b & 0xa8) | ((!b) << 6) | parity(b); break; //RR B
case 0x19: t = c & 1; c = (c >> 1) | (f << 7); f = (t) | (c & 0xa8) | ((!c) << 6) | parity(c); break; //RR C
case 0x1a: t = d & 1; d = (d >> 1) | (f << 7); f = (t) | (d & 0xa8) | ((!d) << 6) | parity(d); break; //RR D
case 0x1b: t = e & 1; e = (e >> 1) | (f << 7); f = (t) | (e & 0xa8) | ((!e) << 6) | parity(e); break; //RR E
case 0x1c: t = h & 1; h = (h >> 1) | (f << 7); f = (t) | (h & 0xa8) | ((!h) << 6) | parity(h); break; //RR H
case 0x1d: t = l & 1; l = (l >> 1) | (f << 7); f = (t) | (l & 0xa8) | ((!l) << 6) | parity(l); break; //RR L
case 0x1e: //RR (HL/IX+e/IY+e)
tstates += 7; val = fetch(addr);
t = val & 1; val = (val >> 1) | (f << 7); f = (t) | (val & 0xa8) | ((!val) << 6) | parity(val);
store(addr, val);
break;
case 0x1f: t = a & 1; a = (a >> 1) | (f << 7); f = (t) | (a & 0xa8) | ((!a) << 6) | parity(a); break; //RRA
case 0x20: t = b >> 7; b <<= 1; f = (t) | (b & 0xa8) | ((!b) << 6) | parity(b); break; //SLA B
case 0x21: t = c >> 7; c <<= 1; f = (t) | (c & 0xa8) | ((!c) << 6) | parity(c); break; //SLA C
case 0x22: t = d >> 7; d <<= 1; f = (t) | (d & 0xa8) | ((!d) << 6) | parity(d); break; //SLA D
case 0x23: t = e >> 7; e <<= 1; f = (t) | (e & 0xa8) | ((!e) << 6) | parity(e); break; //SLA E
case 0x24: t = h >> 7; h <<= 1; f = (t) | (h & 0xa8) | ((!h) << 6) | parity(h); break; //SLA H
case 0x25: t = l >> 7; l <<= 1; f = (t) | (l & 0xa8) | ((!l) << 6) | parity(l); break; //SLA L
case 0x26: //SLA (HL/IX+e/IY+e)
tstates += 7; val = fetch(addr);
t = val >> 7; val <<= 1; f = (t) | (val & 0xa8) | ((!val) << 6) | parity(val);
store(addr, val);
break;
case 0x27: t = a >> 7; a <<= 1; f = (t) | (a & 0xa8) | ((!a) << 6) | parity(a); break; //SLA A
case 0x28: t = b & 1; b = ((signed char)b) >> 1; f = (t) | (b & 0xa8) | ((!b) << 6) | parity(b); break; //SRA B
case 0x29: t = c & 1; c = ((signed char)c) >> 1; f = (t) | (c & 0xa8) | ((!c) << 6) | parity(c); break; //SRA C
case 0x2a: t = d & 1; d = ((signed char)d) >> 1; f = (t) | (d & 0xa8) | ((!d) << 6) | parity(d); break; //SRA D
case 0x2b: t = e & 1; e = ((signed char)e) >> 1; f = (t) | (e & 0xa8) | ((!e) << 6) | parity(e); break; //SRA E
case 0x2c: t = h & 1; h = ((signed char)h) >> 1; f = (t) | (h & 0xa8) | ((!h) << 6) | parity(h); break; //SRA H
case 0x2d: t = l & 1; l = ((signed char)l) >> 1; f = (t) | (l & 0xa8) | ((!l) << 6) | parity(l); break; //SRA L
case 0x2e: //SRA (HL/IX+e/IY+e)
tstates += 7; val = fetch(addr);
t = val & 1; val = ((signed char)val) >> 1; f = (t) | (val & 0xa8) | ((!val) << 6) | parity(val);
store(addr, val);
break;
case 0x2f: t = a & 1; a = ((signed char)a) >> 1; f = (t) | (a & 0xa8) | ((!a) << 6) | parity(a); break; //SRA A
case 0x30: t = b >> 7; b = (b << 1) | 1; f = (t) | (b & 0xa8) | ((!b) << 6) | parity(b); break; //undefine
case 0x31: t = c >> 7; c = (c << 1) | 1; f = (t) | (c & 0xa8) | ((!c) << 6) | parity(c); break; //undefine
case 0x32: t = d >> 7; d = (d << 1) | 1; f = (t) | (d & 0xa8) | ((!d) << 6) | parity(d); break; //undefine
case 0x33: t = e >> 7; e = (e << 1) | 1; f = (t) | (e & 0xa8) | ((!e) << 6) | parity(e); break; //undefine
case 0x34: t = h >> 7; h = (h << 1) | 1; f = (t) | (h & 0xa8) | ((!h) << 6) | parity(h); break; //undefine
case 0x35: t = l >> 7; l = (l << 1) | 1; f = (t) | (l & 0xa8) | ((!l) << 6) | parity(l); break; //undefine
case 0x36: //undefine
tstates += 7; val = fetch(addr);
t = val >> 7; val = (val << 1) | 1; f = (t) | (val & 0xa8) | ((!val) << 6) | parity(val);
store(addr, val);
break;
case 0x37: t = a >> 7; a = (a << 1) | 1; f = (t) | (a & 0xa8) | ((!a) << 6) | parity(a); break; //undefine
case 0x38: t = b & 1; b >>= 1; f = (t) | (b & 0xa8) | ((!b) << 6) | parity(b); break; //SRL B
case 0x39: t = c & 1; c >>= 1; f = (t) | (c & 0xa8) | ((!c) << 6) | parity(c); break; //SRL C
case 0x3a: t = d & 1; d >>= 1; f = (t) | (d & 0xa8) | ((!d) << 6) | parity(d); break; //SRL D
case 0x3b: t = e & 1; e >>= 1; f = (t) | (e & 0xa8) | ((!e) << 6) | parity(e); break; //SRL E
case 0x3c: t = h & 1; h >>= 1; f = (t) | (h & 0xa8) | ((!h) << 6) | parity(h); break; //SRL H
case 0x3d: t = l & 1; l >>= 1; f = (t) | (l & 0xa8) | ((!l) << 6) | parity(l); break; //SRL L
case 0x3e: //SRL (HL/IX+e/IY+e)
tstates += 7; val = fetch(addr);
t = val & 1; val >>= 1; f = (t) | (val & 0xa8) | ((!val) << 6) | parity(val);
store(addr, val);
break;
case 0x3f: t = a & 1; a >>= 1; f = (t) | (a & 0xa8) | ((!a) << 6) | parity(a); break; //SRL A
}
} else {
unsigned char n = (op >> 3) & 7;
switch (op & 0xc7) {
case 0x40: f = (f & 1) | ((b & (1 << n)) ? 0x10 : 0x54) | (b & 0x28); break; //BIT 0-7,B
case 0x41: f = (f & 1) | ((c & (1 << n)) ? 0x10 : 0x54) | (c & 0x28); break; //BIT 0-7,C
case 0x42: f = (f & 1) | ((d & (1 << n)) ? 0x10 : 0x54) | (d & 0x28); break; //BIT 0-7,D
case 0x43: f = (f & 1) | ((e & (1 << n)) ? 0x10 : 0x54) | (e & 0x28); break; //BIT 0-7,E
case 0x44: f = (f & 1) | ((h & (1 << n)) ? 0x10 : 0x54) | (h & 0x28); break; //BIT 0-7,H
case 0x45: f = (f & 1) | ((l & (1 << n)) ? 0x10 : 0x54) | (l & 0x28); break; //BIT 0-7,L
case 0x46: //BIT 0-7,(HL/IX+e/IY+e)
tstates += 4;
val = fetch(addr);
f = (f & 1) | ((val & (1 << n)) ? 0x10 : 0x54) | (val & 0x28);
store(addr, val);
break;
case 0x47: f = (f & 1) | ((a & (1 << n)) ? 0x10 : 0x54) | (a & 0x28); break; //BIT 0-7,A
case 0x80: b &= ~(1 << n); break; //RES 0-7,B
case 0x81: c &= ~(1 << n); break; //RES 0-7,C
case 0x82: d &= ~(1 << n); break; //RES 0-7,D
case 0x83: e &= ~(1 << n); break; //RES 0-7,E
case 0x84: h &= ~(1 << n); break; //RES 0-7,H
case 0x85: l &= ~(1 << n); break; //RES 0-7,L
case 0x86: //RES 0-7,(HL/IX+e/IY+e)
tstates += 4;
val = fetch(addr);
val &= ~(1 << n);
store(addr, val);
break;
case 0x87: a &= ~(1 << n); break; //RES 0-7,A
case 0xc0: b |= (1 << n); break; //SET 0-7,B
case 0xc1: c |= (1 << n); break; //SET 0-7,C
case 0xc2: d |= (1 << n); break; //SET 0-7,D
case 0xc3: e |= (1 << n); break; //SET 0-7,E
case 0xc4: h |= (1 << n); break; //SET 0-7,H
case 0xc5: l |= (1 << n); break; //SET 0-7,L
case 0xc6: //SET 0-7,(HL/IX+e/IY+e)
tstates += 4;
val = fetch(addr);
val |= (1 << n);
store(addr, val);
break;
case 0xc7: a |= (1 << n); break; //SET 0-7,A
}
}
if (ixoriy) {
switch (reg) {
case 0: b = val; break;
case 1: c = val; break;
case 2: d = val; break;
case 3: e = val; break;
case 4: h = val; break;
case 5: l = val; break;
case 7: a = val; break;
}
}
}
void fnc_0xcc(void)
{
// CALL Z,nn
tstates += 10;
if (f & 0x40) {
tstates += 7;
sp -= 2;
store2(sp, (pc + 2));
pc = fetch2(pc);
} else {
pc += 2;
}
}
void fnc_0xcd(void)
{
// CALL nn
tstates += 17;
sp -= 2;
store2(sp, (pc + 2));
pc = fetch2(pc);
}
void fnc_0xce(void)
{
// ADC A,n
unsigned short y;
unsigned char z;
tstates += 7;
z = fetch(pc);
y = a + z + ((f & 1));
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) + (z & 0x0f) + ((f & 1)) > 15) << 4) | (((~a ^ z) & 0x80 & (y ^ a)) >> 5);
f |= (!(a = y)) << 6;
pc++;
}
void fnc_0xcf(void)
{
// RST 8H
tstates += 11;
sp -= 2;
store2(sp, (pc));
pc = 8;
}
void fnc_0xd0(void)
{
// RET NC
tstates += 5;
if (!(f & 1)) {
tstates += 6;
pc = fetch2(sp);
sp += 2;
}
}
void fnc_0xd1(void)
{
// POP DE
tstates += 10;
e = fetch(sp);
d = fetch(sp + 1);
sp += 2;
}
void fnc_0xd2(void)
{
// JP NC,nn
tstates += 10;
if (!(f & 1)) {
pc = fetch2(pc);
} else {
pc += 2;
}
}
void fnc_0xd3(void)
{
// OUT (n),A
tstates += 11;
tstates += out(a, fetch(pc), a);
pc++;
}
void fnc_0xd4(void)
{
// CALL NC,nn
tstates += 10;
if (!(f & 1)) {
tstates += 7;
sp -= 2;
store2(sp, (pc + 2));
pc = fetch2(pc);
} else {
pc += 2;
}
}
void fnc_0xd5(void)
{
// PUSH DE
tstates += 11;
sp -= 2;
store2b(sp, d, e);
}
void fnc_0xd6(void)
{
// SUB n
unsigned short y;
unsigned char z;
tstates += 7;
z = (fetch(pc));
y = (a - z - (0)) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f) + (0)) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2;
f |= (!(a = y)) << 6;
pc++;
}
void fnc_0xd7(void)
{
// RST 10H
tstates += 11;
sp -= 2;
store2(sp, (pc));
pc = 0x10;
}
void fnc_0xd8(void)
{
// RET C
tstates += 5;
if (f & 1) {
tstates += 6;
pc = fetch2(sp);
sp += 2;
}
}
void fnc_0xd9(void)
{
// EXX
unsigned char t;
tstates += 4;
t = b; b = b1; b1 = t;
t = c; c = c1; c1 = t;
t = d; d = d1; d1 = t;
t = e; e = e1; e1 = t;
t = h; h = h1; h1 = t;
t = l; l = l1; l1 = t;
}
void fnc_0xda(void)
{
// JP C,nn
tstates += 10;
if (f & 1) {
pc = fetch2(pc);
} else {
pc += 2;
}
}
void fnc_0xdb(void)
{
// IN A,n
unsigned short t;
tstates += 11;
a = t = in(a, fetch(pc));
tstates += t >> 8;
pc++;
}
void fnc_0xdc(void)
{
// CALL C,nn
tstates += 10;
if (f & 1) {
tstates += 7;
sp -= 2;
store2(sp, (pc + 2));
pc = fetch2(pc);
} else {
pc += 2;
}
}
void fnc_0xdd(void)
{
// precode (IX+e)
tstates += 4;
new_ixoriy = 1;
}
void fnc_0xde(void)
{
// SBC A,n
unsigned short y;
unsigned char z;
tstates += 7;
z = (fetch(pc));
y = (a - z - ((f & 1))) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f) + ((f & 1))) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2;
f |= (!(a = y)) << 6;
pc++;
}
void fnc_0xdf(void)
{
// RST 18H
tstates += 11;
sp -= 2;
store2(sp, (pc));
pc = 0x18;
}
void fnc_0xe0(void)
{
// RET PO
tstates += 5;
if (!(f & 4)) {
tstates += 6;
pc = fetch2(sp);
sp += 2;
}
}
void fnc_0xe1(void)
{
// POP HL
// POP IX
// POP IY
tstates += 10;
if (!ixoriy) {
l = fetch(sp);
h = fetch(sp + 1);
sp += 2;
} else if (ixoriy == 1) {
ix = fetch2(sp);
sp += 2;
} else {
iy = fetch2(sp);
sp += 2;
}
}
void fnc_0xe2(void)
{
// JP PO,nn
tstates += 10;
if (!(f & 4)) {
pc = fetch2(pc);
} else {
pc += 2;
}
}
void fnc_0xe3(void)
{
// EX (SP),HL
// EX (SP),IX
// EX (SP),IY
unsigned short t;
tstates += 19;
if (!ixoriy) {
t = fetch2(sp);
store2b(sp, h, l);
l = t;
h = t >> 8;
} else if (ixoriy == 1) {
t = fetch2(sp);
store2(sp, ix);
ix = t;
} else {
t = fetch2(sp);
store2(sp, iy);
iy = t;
}
}
void fnc_0xe4(void)
{
// CALL PO,nn
tstates += 10;
if (!(f & 4)) {
tstates += 7;
sp -= 2;
store2(sp, (pc + 2));
pc = fetch2(pc);
} else {
pc += 2;
}
}
void fnc_0xe5(void)
{
// PUSH HL
// PUSH IX
// PUSH IY
tstates += 11;
if (!ixoriy) {
sp -= 2;
store2b(sp, h, l);
} else if (ixoriy == 1) {
sp -= 2;
store2(sp, (ix));
} else {
sp -= 2;
store2(sp, (iy));
}
}
void fnc_0xe6(void)
{
// AND n
tstates += 7;
a &= (fetch(pc));
f = (a & 0xa8) | ((!a) << 6) | 0x10 | parity(a);
pc++;
}
void fnc_0xe7(void)
{
// RST 20H
tstates += 11;
sp -= 2;
store2(sp, (pc));
pc = 0x20;
}
void fnc_0xe8(void)
{
// RET PE
tstates += 5;
if (f & 4) {
tstates += 6;
pc = fetch2(sp);
sp += 2;
}
}
void fnc_0xe9(void)
{
// JP (HL)
// JP (IX)
// JP (IY)
tstates += 4;
pc = !ixoriy ? hl : ixoriy == 1 ? ix : iy;
}
void fnc_0xea(void)
{
// JP PE,nn
tstates += 10;
if (f & 4) {
pc = fetch2(pc);
} else {
pc += 2;
}
}
void fnc_0xeb(void)
{
// EX DE,HL
unsigned char t;
tstates += 4;
t = h; h = d; d = t;
t = e; e = l; l = t;
}
void fnc_0xec(void)
{
// CALL PE,nn
tstates += 10;
if (f & 4) {
tstates += 7;
sp -= 2;
store2(sp, (pc + 2));
pc = fetch2(pc);
} else {
pc += 2;
}
}
void fnc_0xed(void)
{
unsigned char op;
tstates += 4;
op = fetch(pc);
pc++;
radjust++;
switch (op) {
case 0xfc: fnc_0xedfc(); break;
case 0xfd: fnc_0xedfd(); break;
case 0xfe: fnc_0xedfe(); break;
case 0xff: fnc_0xedff(); break;
default:
if (op >= 0x40 && op <= 0xbf) {
(*z80edops[op - 0x40])();
} else {
fnc_0xedXX();
}
break;
}
}
void fnc_0xedXX(void)
{
tstates += 4;
}
void fnc_0xed40(void)
{
// IN B,(C)
unsigned short u;
tstates += 8;
b = u = in(b, c);
tstates += u >> 8;
f = (f & 1) | (b & 0xa8) | ((!b) << 6) | parity(b);
}
void fnc_0xed41(void)
{
// OUT (C),B
tstates += 8;
tstates += out(b, c, b);
}
void fnc_0xed42(void)
{
// SBC HL,BC
unsigned short z;
unsigned long t;
tstates += 11;
z = (bc);
t = (hl - z - (f & 1)) & 0x1ffff;
f = ((t >> 8) & 0xa8) | (t >> 16) | 2 | (((hl & 0xfff) < (z & 0xfff) + (f & 1)) << 4) | (((hl ^ z) & (hl ^ t) & 0x8000) >> 13) | ((!(t & 0xffff)) << 6) | 2;
l = t;
h = t >> 8;
}
void fnc_0xed43(void)
{
// LD (nn),BC
unsigned short addr;
tstates += 16;
addr = fetch2(pc);
pc += 2;
store2b(addr, b, c);
}
void fnc_0xed44(void)
{
// NEG
tstates += 4;
a = -a;
f = (a & 0xa8) | ((!a) << 6) | (((a & 15) > 0) << 4) | ((a == 128) << 2) | 2 | (a > 0);
}
void fnc_0xed45(void)
{
// RETN
tstates += 10;
iff1 = iff2;
pc = fetch2(sp);
sp += 2;
}
void fnc_0xed46(void)
{
// IM 0
tstates += 4;
im = 0;
}
void fnc_0xed47(void)
{
// LD I,A
tstates += 5;
i = a;
}
void fnc_0xed48(void)
{
// IN C,(C)
unsigned short u;
tstates += 8;
c = u = in(b, c);
tstates += u >> 8;
f = (f & 1) | (c & 0xa8) | ((!c) << 6) | parity(c);
}
void fnc_0xed49(void)
{
// OUT (C),C
tstates += 8;
tstates += out(b, c, c);
}
void fnc_0xed4a(void)
{
// ADC HL,BC
unsigned short z;
unsigned long t;
tstates += 11;
z = (bc);
t = hl + z + (f & 1);
f = ((t >> 8) & 0xa8) | (t >> 16) | (((hl & 0xfff) + (z & 0xfff) + (f & 1) > 0xfff) << 4) | (((~hl ^ z) & (hl ^ t) & 0x8000) >> 13) | ((!(t & 0xffff)) << 6) | 2;
l = t;
h = t >> 8;
}
void fnc_0xed4b(void)
{
// LD BC,(nn)
unsigned short addr;
tstates += 16;
addr = fetch2(pc);
pc += 2;
c = fetch(addr);
b = fetch(addr + 1);
}
void fnc_0xed4d(void)
{
// RETI
tstates += 10;
pc = fetch2(sp);
sp += 2;
}
void fnc_0xed4f(void)
{
// LD R,A
tstates += 5;
r = a;
radjust = r;
}
void fnc_0xed50(void)
{
// IN D,(C)
unsigned short u;
tstates += 8;
d = u = in(b, c);
tstates += u >> 8;
f = (f & 1) | (d & 0xa8) | ((!d) << 6) | parity(d);
}
void fnc_0xed51(void)
{
// OUT (C),D
tstates += 8;
tstates += out(b, c, d);
}
void fnc_0xed52(void)
{
// SBC HL,DE
unsigned short z;
unsigned long t;
tstates += 11;
z = (de);
t = (hl - z - (f & 1)) & 0x1ffff;
f = ((t >> 8) & 0xa8) | (t >> 16) | 2 | (((hl & 0xfff) < (z & 0xfff) + (f & 1)) << 4) | (((hl ^ z) & (hl ^ t) & 0x8000) >> 13) | ((!(t & 0xffff)) << 6) | 2;
l = t;
h = t >> 8;
}
void fnc_0xed53(void)
{
// LD (nn),DE
unsigned short addr;
tstates += 16;
addr = fetch2(pc);
pc += 2;
store2b(addr, d, e);
}
void fnc_0xed56(void)
{
// IM 1
tstates += 4;
im = 2;
}
void fnc_0xed57(void)
{
// LD A,I
tstates += 5;
a = i;
f = (f & 1) | (a & 0xa8) | ((!a) << 6) | (iff2 << 2);
}
void fnc_0xed58(void)
{
// IN E,(C)
unsigned short u;
tstates += 8;
e = u = in(b, c);
tstates += u >> 8;
f = (f & 1) | (e & 0xa8) | ((!e) << 6) | parity(e);
}
void fnc_0xed59(void)
{
// OUT (C),E
tstates += 8;
tstates += out(b, c, e);
}
void fnc_0xed5a(void)
{
// ADC HL,DE
unsigned short z;
unsigned long t;
tstates += 11;
z = (de);
t = hl + z + (f & 1);
f = ((t >> 8) & 0xa8) | (t >> 16) | (((hl & 0xfff) + (z & 0xfff) + (f & 1) > 0xfff) << 4) | (((~hl ^ z) & (hl ^ t) & 0x8000) >> 13) | ((!(t & 0xffff)) << 6) | 2;
l = t;
h = t >> 8;
}
void fnc_0xed5b(void)
{
// LD DE,(nn)
unsigned short addr;
tstates += 16;
addr = fetch2(pc);
pc += 2;
e = fetch(addr);
d = fetch(addr + 1);
}
void fnc_0xed5e(void)
{
// IM 2
tstates += 4;
im = 3;
}
void fnc_0xed5f(void)
{
// LD A,R
tstates += 5;
r = (r & 0x80) | (radjust & 0x7f);
a = r;
f = (f & 1) | (a & 0xa8) | ((!a) << 6) | (iff2 << 2);
}
void fnc_0xed60(void)
{
// IN H,(C)
unsigned short u;
tstates += 8;
h = u = in(b, c);
tstates += u >> 8;
f = (f & 1) | (h & 0xa8) | ((!h) << 6) | parity(h);
}
void fnc_0xed61(void)
{
// OUT (C),H
tstates += 8;
tstates += out(b, c, h);
}
void fnc_0xed62(void)
{
// SBC HL,HL
unsigned short z;
unsigned long t;
tstates += 11;
z = (hl);
t = (hl - z - (f & 1)) & 0x1ffff;
f = ((t >> 8) & 0xa8) | (t >> 16) | 2 | (((hl & 0xfff) < (z & 0xfff) + (f & 1)) << 4) | (((hl ^ z) & (hl ^ t) & 0x8000) >> 13) | ((!(t & 0xffff)) << 6) | 2;
l = t;
h = t >> 8;
}
void fnc_0xed63(void)
{
// LD (nn),HL
unsigned short addr;
tstates += 16;
addr = fetch2(pc);
pc += 2;
store2b(addr, h, l);
}
void fnc_0xed67(void)
{
// RRD
unsigned char t;
unsigned char u;
tstates += 14;
t = fetch(hl);
u = (a << 4) | (t >> 4);
a = (a & 0xf0) | (t & 0x0f);
store(hl, u);
f = (f & 1) | (a & 0xa8) | ((!a) << 6) | parity(a);
}
void fnc_0xed68(void)
{
// IN L,(C)
unsigned short u;
tstates += 8;
l = u = in(b, c);
tstates += u >> 8;
f = (f & 1) | (l & 0xa8) | ((!l) << 6) | parity(l);
}
void fnc_0xed69(void)
{
// OUT (C),L
tstates += 8;
tstates += out(b, c, l);
}
void fnc_0xed6a(void)
{
// ADC HL,HL
unsigned short z;
unsigned long t;
tstates += 11;
z = (hl);
t = hl + z + (f & 1);
f = ((t >> 8) & 0xa8) | (t >> 16) | (((hl & 0xfff) + (z & 0xfff) + (f & 1) > 0xfff) << 4) | (((~hl ^ z) & (hl ^ t) & 0x8000) >> 13) | ((!(t & 0xffff)) << 6) | 2;
l = t;
h = t >> 8;
}
void fnc_0xed6b(void)
{
// LD HL,(nn)
unsigned short addr;
tstates += 16;
addr = fetch2(pc);
pc += 2;
l = fetch(addr);
h = fetch(addr + 1);
}
void fnc_0xed6f(void)
{
// RLD
unsigned char t;
unsigned char u;
tstates += 5;
t = fetch(hl);
u = (a & 0x0f) | (t << 4);
a = (a & 0xf0) | (t >> 4);
store(hl, u);
f = (f & 1) | (a & 0xa8) | ((!a) << 6) | parity(a);
}
void fnc_0xed72(void)
{
// SBC HL,SP
unsigned short z;
unsigned long t;
tstates += 11;
z = (sp);
t = (hl - z - (f & 1)) & 0x1ffff;
f = ((t >> 8) & 0xa8) | (t >> 16) | 2 | (((hl & 0xfff) < (z & 0xfff) + (f & 1)) << 4) | (((hl ^ z) & (hl ^ t) & 0x8000) >> 13) | ((!(t & 0xffff)) << 6) | 2;
l = t;
h = t >> 8;
}
void fnc_0xed73(void)
{
// LD (nn),SP
unsigned short addr;
tstates += 16;
addr = fetch2(pc);
pc += 2;
store2(addr, sp);
}
void fnc_0xed78(void)
{
// IN A,(C)
unsigned short u;
tstates += 8;
a = u = in(b, c);
tstates += u >> 8;
f = (f & 1) | (a & 0xa8) | ((!a) << 6) | parity(a);
}
void fnc_0xed79(void)
{
// OUT (C),A
tstates += 8;
tstates += out(b, c, a);
}
void fnc_0xed7a(void)
{
// ADC HL,SP
unsigned short z;
unsigned long t;
tstates += 11;
z = (sp);
t = hl + z + (f & 1);
f = ((t >> 8) & 0xa8) | (t >> 16) | (((hl & 0xfff) + (z & 0xfff) + (f & 1) > 0xfff) << 4) | (((~hl ^ z) & (hl ^ t) & 0x8000) >> 13) | ((!(t & 0xffff)) << 6) | 2;
l = t;
h = t >> 8;
}
void fnc_0xed7b(void)
{
// LD SP,(nn)
unsigned short addr;
tstates += 16;
addr = fetch2(pc);
pc += 2;
sp = fetch2(addr);
}
void fnc_0xeda0(void)
{
// LDI
unsigned char x;
tstates += 12;
x = fetch(hl);
store(de, x);
if (!++l)h++;
if (!++e)d++;
if (!c--)b--;
f = (f & 0xc1) | (x & 0x28) | (((b | c) > 0) << 2);
}
void fnc_0xeda1(void)
{
// CPI
unsigned char carry;
unsigned short y;
unsigned char z;
tstates += 12;
carry = (f & 1);
z = (fetch(hl));
y = (a - z) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f)) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2 | ((!y) << 6);
if (!++l)h++;
if (!c--)b--;
f = (f & 0xfa) | carry | (((b | c) > 0) << 2);
}
void fnc_0xeda2(void)
{
// INI
unsigned short t;
tstates += 12;
t = in(b, c);
store(hl, t);
tstates += t >> 8;
if (!++l)h++;
b--;
f = (b & 0xa8) | ((b > 0) << 6) | 2 | ((parity(b)^c) & 4);
}
void fnc_0xeda3(void)
{
// OUTI
unsigned char x;
tstates += 12;
x = fetch(hl);
tstates += out(b, c, x);
if (!++l)h++;
b--;
f = (f & 1) | 0x12 | (b & 0xa8) | ((b == 0) << 6);
}
void fnc_0xeda8(void)
{
// LDD
unsigned char x;
tstates += 12;
x = fetch(hl);
store(de, x);
if (!l--)h--;
if (!e--)d--;
if (!c--)b--;
f = (f & 0xc1) | (x & 0x28) | (((b | c) > 0) << 2);
}
void fnc_0xeda9(void)
{
// CPD
unsigned char carry;
unsigned short y;
unsigned char z;
tstates += 12;
carry = (f & 1);
z = (fetch(hl));
y = (a - z) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f)) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2 | ((!y) << 6);
if (!l--)h--;
if (!c--)b--;
f = (f & 0xfa) | carry | (((b | c) > 0) << 2);
}
void fnc_0xedaa(void)
{
// IND
unsigned short t;
tstates += 12;
t = in(b, c);
store(hl, t);
tstates += t >> 8;
if (!l--)h--;
b--;
f = (b & 0xa8) | ((b > 0) << 6) | 2 | ((parity(b)^c ^ 4) & 4);
}
void fnc_0xedab(void)
{
// OUTD
unsigned char x;
tstates += 12;
x = fetch(hl);
tstates += out(b, c, x);
if (!l--)h--;
b--;
f = (f & 1) | 0x12 | (b & 0xa8) | ((b == 0) << 6);
}
void fnc_0xedb0(void)
{
// LDIR
unsigned char x;
tstates += 12;
x = fetch(hl);
store(de, x);
if (!++l)h++;
if (!++e)d++;
if (!c--)b--;
f = (f & 0xc1) | (x & 0x28) | (((b | c) > 0) << 2);
if (b | c)pc -= 2, tstates += 5;
}
void fnc_0xedb1(void)
{
// CPIR
unsigned char carry;
unsigned short y;
unsigned char z;
tstates += 12;
carry = (f & 1);
z = (fetch(hl));
y = (a - z) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f)) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2 | ((!y) << 6);
if (!++l)h++;
if (!c--)b--;
f = (f & 0xfa) | carry | (((b | c) > 0) << 2);
if ((f & 0x44) == 4)pc -= 2, tstates += 5;
}
void fnc_0xedb2(void)
{
// INIR
unsigned short t;
tstates += 12;
t = in(b, c);
store(hl, t);
tstates += t >> 8;
if (!++l)h++;
b--;
f = (b & 0xa8) | ((b > 0) << 6) | 2 | ((parity(b)^c) & 4);
if (b)pc -= 2, tstates += 5;
}
void fnc_0xedb3(void)
{
// OTIR
unsigned char x;
tstates += 12;
x = fetch(hl);
tstates += out(b, c, x);
if (!++l)h++;
b--;
f = (f & 1) | 0x12 | (b & 0xa8) | ((b == 0) << 6);
if (b)pc -= 2, tstates += 5;
}
void fnc_0xedb8(void)
{
// LDDR
unsigned char x;
tstates += 12;
x = fetch(hl);
store(de, x);
if (!l--)h--;
if (!e--)d--;
if (!c--)b--;
f = (f & 0xc1) | (x & 0x28) | (((b | c) > 0) << 2);
if (b | c)pc -= 2, tstates += 5;
}
void fnc_0xedb9(void)
{
// CPDR
unsigned char carry;
unsigned short y;
unsigned char z;
tstates += 12;
carry = (f & 1);
z = (fetch(hl));
y = (a - z) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f)) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2 | ((!y) << 6);
if (!l--)h--;
if (!c--)b--;
f = (f & 0xfa) | carry | (((b | c) > 0) << 2);
if ((f & 0x44) == 4)pc -= 2, tstates += 5;
}
void fnc_0xedba(void)
{
// INDR
unsigned short t;
tstates += 12;
t = in(b, c);
store(hl, t);
tstates += t >> 8;
if (!l--)h--;
b--;
f = (b & 0xa8) | ((b > 0) << 6) | 2 | ((parity(b)^c ^ 4) & 4);
if (b)pc -= 2, tstates += 5;
}
void fnc_0xedbb(void)
{
// OTDR
unsigned char x;
tstates += 12;
x = fetch(hl);
tstates += out(b, c, x);
if (!l--)h--;
b--;
f = (f & 1) | 0x12 | (b & 0xa8) | ((b == 0) << 6);
if (b)pc -= 2, tstates += 5;
}
// mzf disk file access
// read_inf()
void fnc_0xedfc(void)
{
tstates += 4;
//if (read_inf() == 0) f = a = 0; else f = 1, a = 2;
// JP RTP4
//pc = 0x0552;
}
// mzf disk file access
// read_data()
void fnc_0xedfd(void)
{
tstates += 4;
//if (read_data() == 0) f = a = 0; else f = 1, a = 2;
// RET (jump to C9 instruction)
//pc = 0x0562;
}
// mzf disk file access
// write_inf()
void fnc_0xedfe(void)
{
tstates += 4;
//if (write_inf() == 0) f = 0; else f = 1;
//pc = 0x04ce;
}
// mzf disk file access
// write_data()
void fnc_0xedff(void)
{
tstates += 4;
//if (write_data() == 0) f = 0; else f = 1;
//pc = 0x04ce;
}
void fnc_0xee(void)
{
// XOR n
tstates += 7;
a ^= (fetch(pc));
f = (a & 0xa8) | ((!a) << 6) | parity(a);
pc++;
}
void fnc_0xef(void)
{
// RST 28H
tstates += 11;
sp -= 2;
store2(sp, (pc));
pc = 0x28;
}
void fnc_0xf0(void)
{
// RET P
tstates += 5;
if (!(f & 0x80)) {
tstates += 6;
pc = fetch2(sp);
sp += 2;
}
}
void fnc_0xf1(void)
{
// POP AF
tstates += 10;
f = fetch(sp);
a = fetch(sp + 1);
sp += 2;
}
void fnc_0xf2(void)
{
// JP P,nn
tstates += 10;
if (!(f & 0x80)) {
pc = fetch2(pc);
} else {
pc += 2;
}
}
void fnc_0xf3(void)
{
// DI
tstates += 4;
iff1 = iff2 = 0;
}
void fnc_0xf4(void)
{
// CALL P,nn
tstates += 10;
if (!(f & 0x80)) {
tstates += 7;
sp -= 2;
store2(sp, (pc + 2));
pc = fetch2(pc);
} else {
pc += 2;
}
}
void fnc_0xf5(void)
{
// PUSH AF
tstates += 11;
sp -= 2;
store2b(sp, a, f);
}
void fnc_0xf6(void)
{
// OR n
tstates += 7;
a |= (fetch(pc));
f = (a & 0xa8) | ((!a) << 6) | parity(a);
pc++;
}
void fnc_0xf7(void)
{
// RST 30H
tstates += 11;
sp -= 2;
store2(sp, (pc));
pc = 0x30;
}
void fnc_0xf8(void)
{
// RET M
tstates += 5;
if (f & 0x80) {
tstates += 6;
pc = fetch2(sp); sp += 2;
}
}
void fnc_0xf9(void)
{
// LD SP,HL
// LD SP,IX
// LD SP,IY
tstates += 6;
sp = !ixoriy ? hl : ixoriy == 1 ? ix : iy;
}
void fnc_0xfa(void)
{
// JP M,nn
tstates += 10;
if (f & 0x80) {
pc = fetch2(pc);
} else {
pc += 2;
}
}
void fnc_0xfb(void)
{
// EI
tstates += 4;
iff1 = iff2 = 1;
}
void fnc_0xfc(void)
{
// CALL M,nn
tstates += 10;
if (f & 0x80) {
tstates += 7;
sp -= 2;
store2(sp, (pc + 2));
pc = fetch2(pc);
} else {
pc += 2;
}
}
void fnc_0xfd(void)
{
// precode IY+e
tstates += 4;
new_ixoriy = 2;
}
void fnc_0xfe(void)
{
// CP n
unsigned short y;
unsigned char z;
tstates += 7;
z = (fetch(pc));
y = (a - z) & 0x1ff;
f = (y & 0xa8) | (y >> 8) | (((a & 0x0f) < (z & 0x0f)) << 4) | (((a ^ z) & 0x80 & (y ^ a)) >> 5) | 2 | ((!y) << 6);
pc++;
}
void fnc_0xff(void)
{
// RST 38H
tstates += 11;
sp -= 2;
store2(sp, (pc));
pc = 0x38;
}
/*** end of z80.c ***************************************************************************/
|
2bd24bb56d235445ff9a9feca07c65a3b792ca3a | 43b2cc2b8c8be8fa65f7a685fa9515a66a83f485 | /lib/include/prc/card.hpp | 0e6cd1e0cbd303a49533cba8d8bd1757102b6a57 | [
"BSL-1.0"
] | permissive | theodelrieu/prc | 8fcb109dc2684f8c343675498a8143de68400f06 | 199942ed8365f6e49a7e9667d587d1ae06f14999 | refs/heads/master | 2023-03-27T01:51:14.185499 | 2021-03-15T22:39:47 | 2021-03-15T22:39:47 | 318,251,443 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 613 | hpp | card.hpp | #pragma once
#include <iosfwd>
#include <string>
#include <prc/parser/ast.hpp>
#include <prc/rank.hpp>
#include <prc/suit.hpp>
namespace prc
{
class card
{
public:
card() = default;
card(prc::rank r, prc::suit s);
explicit card(parser::ast::card);
prc::rank const& rank() const;
prc::suit const& suit() const;
std::string string() const;
private:
prc::rank _r;
prc::suit _s;
};
bool operator==(card const&, card const&) noexcept;
bool operator!=(card const&, card const&) noexcept;
bool operator<(card const&, card const&) noexcept;
std::ostream& operator<<(std::ostream&, card const&);
}
|
096f147107934dc70b53db4cc7ee83f034290ea3 | 7bc74c12d85d5298f437d043fdc48943ccfdeda7 | /001_Project/003_Ford/src/src/ParkAssistSrv_Common/CAMBProviderHandler.cpp | 3161156b8f3570dd6b4ec049a2922b6f1fa98163 | [] | no_license | BobDeng1974/cameraframework-github | 364dd6e9c3d09a06384bb4772a24ed38b49cbc30 | 86efc7356d94f4957998e6e0ae718bd9ed4a4ba0 | refs/heads/master | 2020-08-29T16:14:02.898866 | 2017-12-15T14:55:25 | 2017-12-15T14:55:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,875 | cpp | CAMBProviderHandler.cpp | /*********************************************************************
* Project Ford LCIS- Park-Asist
* (c) copyright 2016
* Company Harman International
* All rights reserved
*
*Secrecy Level STRICTLY CONFIDENTIAL
*********************************************************************/
/**
* @file CAMBProviderHandler.cpp
* @ingroup Park-Asist
* @author Atita Halemani and Ashwini Shamaprasad (Atita.Halemani@harman.com and Ashwini.Shamaprasad@harman.com)
* @brief CAMBProviderHandler provide the interface to RVC,APA ,VPA and in turn requests events to AMB
*
*/
#include"CAMBProviderHandler.hpp"
using namespace std::placeholders;
CAMBProviderHandler:: CAMBProviderHandler() :m_pobjAMBCamerainfoProxy(nullptr), m_pobjAMBBodyCntlInfoProxy(nullptr),m_AMBApaPxy(nullptr)
{
LOG_INFO(LOG_COMMON,"CAMBProviderHandler constructor");
}
CAMBProviderHandler::~CAMBProviderHandler()
{
LOG_INFO(LOG_COMMON,"CAMBProviderHandler Destructor");
}
/**
* @brief Function to initialise CAMBProviderHandler and providing interface to set AMBCameraInfo handle
* @param camerainfoProxy - to get Shared pointer of camerainfoProxy interface
*/
void CAMBProviderHandler::InitializeAMBProviderHandler(std::shared_ptr<camerainfoProxy<>> &p_pobjAMBCameraInfo, std::shared_ptr<bodycontroldataProxy<>> &p_pobjAMB_BodyCntlInfoProxy,
std::shared_ptr<actvparkassistProxy<>> &p_pobjAMBApaPxy)
{
if(NULL != p_pobjAMBCameraInfo && NULL != p_pobjAMB_BodyCntlInfoProxy && NULL != p_pobjAMBApaPxy)
{
m_pobjAMBCamerainfoProxy = p_pobjAMBCameraInfo;
m_pobjAMBBodyCntlInfoProxy = p_pobjAMB_BodyCntlInfoProxy;
m_AMBApaPxy = p_pobjAMBApaPxy;
LOG_INFO(LOG_RVC,"InitializeAMBProviderHandler ");
}
}
/**
* @brief Function to De initialize CAMBProviderHandler
* @param None
*/
void CAMBProviderHandler::Deinitialize()
{
LOG_INFO(LOG_RVC,"CAMBProviderHandler DeInitialize Called");
}
/**
* @brief Function to interact with AMB to set/reset zoom
* @param OnOff - Value is true for setting zoom and false for resetting the zoom
*/
void CAMBProviderHandler::SetRVCZoom(bool OnOff)
{
camerainfo_types::CamraZoomMan_D_Rq_enum l_UpdatedValue;
LOG_INFO(LOG_RVC,"SetRVCZoom called");
if((nullptr !=m_pobjAMBCamerainfoProxy)&&(true == OnOff))
{
//Requesting ECU through AMB to zoom in RVC image
m_pobjAMBCamerainfoProxy->getCamraZoomMan_D_Rq_enumAttribute().setValueAsync(camerainfo_types::CamraZoomMan_D_Rq_enum::En_Zoom_Level_III,(std::bind(&CAMBProviderHandler::asyncZommAttributeCallback, this, _1,_2)));
}
else if((nullptr !=m_pobjAMBCamerainfoProxy)&&(false == OnOff))
{
//Requesting ECU through AMB to zoom out RVC image
m_pobjAMBCamerainfoProxy->getCamraZoomMan_D_Rq_enumAttribute().setValueAsync(camerainfo_types::CamraZoomMan_D_Rq_enum::En_Off,(std::bind(&CAMBProviderHandler::asyncZommAttributeCallback, this, _1,_2)));
}
}
/**
* @brief Function to interact with AMB to set/reset Split-view for camera
* @param OnOff - Value is true for setting Split-view and false for resetting the Split-view
*/
void CAMBProviderHandler::SetRVCSplitView(bool OnOff)
{
camerainfo_types::CamraViewSplit_B_Rq_enum l_UpdatedValue;
LOG_INFO(LOG_RVC,"SetRVCSplitView called");
if((nullptr !=m_pobjAMBCamerainfoProxy)&&(true == OnOff))
{
//Requesting ECU through AMB to Enable Split VIew image
m_pobjAMBCamerainfoProxy->getCamraViewSplit_B_Rq_enumAttribute().setValueAsync(camerainfo_types::CamraViewSplit_B_Rq_enum::En_On,(std::bind(&CAMBProviderHandler::asyncSplitViewAttributeCallback, this, _1,_2)));
}
else if((nullptr !=m_pobjAMBCamerainfoProxy)&&(false == OnOff))
{
//Requesting ECU through AMB to Dis-able Split VIew image
m_pobjAMBCamerainfoProxy->getCamraViewSplit_B_Rq_enumAttribute().setValueAsync(camerainfo_types::CamraViewSplit_B_Rq_enum::En_Off,(std::bind(&CAMBProviderHandler::asyncSplitViewAttributeCallback, this, _1,_2)));
}
}
/**
* @brief Function to interact with AMB to set/reset Enhanced Park aid for camera
* @param OnOff - Value is true for setting Enhanced Park aid and false for resetting the Split-view
*/
void CAMBProviderHandler::SetEnhancedParkMode(bool OnOff)
{
// To do implement once AMB provides CAN SIgnals
LOG_INFO(LOG_RVC,"SetEnhancedParkMode is called");
if( ( nullptr != m_pobjAMBBodyCntlInfoProxy ) && ( true == OnOff ) )
{
//DistanceBarSetting_enm::On is used to set enhanced park mode
LOG_INFO(LOG_RVC,"SetEnhancedParkMode true ");
m_pobjAMBBodyCntlInfoProxy->getDistanceBarSetting_enumAttribute().setValueAsync(bodycontroldata_types::DistanceBarSetting_enum::En_On,(std::bind(&CAMBProviderHandler::asyncDistanceBarSettingAttributeCallback, this, _1,_2)));
}
else if( ( nullptr !=m_pobjAMBBodyCntlInfoProxy ) && ( false == OnOff ) )
{
//DistanceBarSetting_enm::Off is used to set enhanced park mode
LOG_INFO(LOG_RVC,"SetEnhancedParkMode as false ");
m_pobjAMBBodyCntlInfoProxy->getDistanceBarSetting_enumAttribute().setValueAsync(bodycontroldata_types::DistanceBarSetting_enum::En_Off,(std::bind(&CAMBProviderHandler::asyncDistanceBarSettingAttributeCallback, this, _1,_2)));
}
}
/**
* @brief Function to set Static Guideline for RVC
* @param :
*/
void CAMBProviderHandler::SetStaticGuideLine()
{
if(nullptr !=m_pobjAMBCamerainfoProxy)
{
//Sending CAN message to camera ECU through AMB camera info interface to enable Static guideline
m_pobjAMBCamerainfoProxy->getCamraOvrlStat_D_Rq_enumAttribute().setValueAsync(camerainfo_types::CamraOvrlStat_D_Rq_enum::En_On,(std::bind(&CAMBProviderHandler::asyncCamraOvrlStatAttributeCallback, this, _1,_2)));
LOG_INFO(LOG_RVC,"Setting static guideline On for RVC always for RVC");
}
}
/**
* @brief Function to set Dynamic Guideline for RVC
* @param :s
*/
void CAMBProviderHandler::SetDyanamicGuideLine()
{
if(nullptr !=m_pobjAMBCamerainfoProxy)
{
//Sending CAN message to camera ECU through AMB camera info interface to enable Dynamic guideline
m_pobjAMBCamerainfoProxy->getCamraOvrlDyn_D_Rq_enumAttribute().setValueAsync(camerainfo_types::CamraOvrlDyn_D_Rq_enum::En_On,(std::bind(&CAMBProviderHandler::asyncCamraOvrlDynAttributeCallback, this, _1,_2)));
LOG_INFO(LOG_RVC,"Setting DyanamicGuideLine On for RVC always for RVC");
}
}
/**
* @brief Function to set Centre Guideline for RVC
* @param :s
*/
void CAMBProviderHandler::SetCentreGuideLine()
{
if(nullptr !=m_pobjAMBCamerainfoProxy)
{
LOG_INFO(LOG_RVC,"Set Centre GuideLine for RVC");
m_pobjAMBCamerainfoProxy->getCamraOvrlTow_D_Rq_enumAttribute().setValueAsync(camerainfo_types::CamraOvrlTow_D_Rq_enum::En_On,(std::bind(&CAMBProviderHandler::asyncCamraOvrlTowAttributeCallback, this, _1,_2)));
}
}
/**
* @brief Function Callback from AMB to inform whether setting of CamraOvrlStatAttribute is succeed or failed
* @param : CamraOvrlStat_D_Rq_enm
* @param : CallStatus
*/
void CAMBProviderHandler::asyncCamraOvrlStatAttributeCallback(const CommonAPI::CallStatus &status,const camerainfo_types::CamraOvrlStat_D_Rq_enum &value)
{
LOG_INFO(LOG_RVC,"asyncCamraOvrlStatAttributeCallback called");
}
/**
*@brief Function Callback from AMB to inform whether setting of CamraOvrlDynAttribute is succeed or failed
@param : CamraOvrlDyn_D_Rq_enm
@param : CallStatus
*/
void CAMBProviderHandler::asyncCamraOvrlDynAttributeCallback(const CommonAPI::CallStatus &status,const camerainfo_types::CamraOvrlDyn_D_Rq_enum &value)
{
LOG_INFO(LOG_RVC,"asyncCamraOvrlDynAttributeCallback called");
}
/**
* @brief Function Callback from AMB to inform whether setting of enhanced mode setting is succeed or failed
@param : DistanceBarSetting_enm
@param : CallStatus
*/
void CAMBProviderHandler::asyncDistanceBarSettingAttributeCallback(const CommonAPI::CallStatus &status,const bodycontroldata_types::DistanceBarSetting_enum &value)
{
LOG_INFO(LOG_RVC,"asyncDistanceBarSettingAttributeCallback called");
}
/**
*@brief Function Callback from AMB to inform whether setting of CamraOvrlTow_D_Rq_enm is succeed or failed
*@param : CamraOvrlTow_D_Rq_enm
* @param : CallStatus
*/
void CAMBProviderHandler::asyncCamraOvrlTowAttributeCallback(const CommonAPI::CallStatus &status,const camerainfo_types::CamraOvrlTow_D_Rq_enum &value)
{
LOG_INFO(LOG_RVC,"asyncCamraOvrlTowAttributeCallback called");
}
/**
*@brief Function Callback from AMB to inform whether setting of ZommAttribute is succeed or failed
@param : CamraZoomMan_D_Rq_enm
@param : CallStatus
*/
void CAMBProviderHandler::asyncZommAttributeCallback(const CommonAPI::CallStatus &status,const camerainfo_types::CamraZoomMan_D_Rq_enum &value)
{
LOG_INFO(LOG_RVC,"asyncZommAttributeCallback called");
}
void CAMBProviderHandler::APAModeReqCB(const CommonAPI::CallStatus &status, const v0::org::harman::ford::actvparkassist_types::ApaMdeStat_D_RqDrv_enum &p_eApaMdeStat)
{
LOG_INFO(LOG_APA,"APAModeReqCB called");
}
void CAMBProviderHandler::asyncSplitViewAttributeCallback(const CommonAPI::CallStatus &status,const camerainfo_types::CamraViewSplit_B_Rq_enum &value)
{
LOG_INFO(LOG_RVC,"asyncSplitViewAttributeCallback called");
}
void CAMBProviderHandler::APAModeReqToAMB(v0::org::harman::ford::actvparkassist_types::ApaMdeStat_D_RqDrv_enum p_eApaMdeStat)
{
LOG_INFO(LOG_APA, "APAModeReqToAMB And Data is >> %d", p_eApaMdeStat);
if(NULL != m_AMBApaPxy)
{
m_AMBApaPxy->getApaMdeStat_D_RqDrv_enumAttribute().setValueAsync(p_eApaMdeStat,(std::bind(&CAMBProviderHandler::APAModeReqCB, this, _1,_2)));
}
}
|
f210bd8b9fe1cc72f52a29252af97891c7bff97f | 39a1d46fdf2acb22759774a027a09aa9d10103ba | /ngraph/core/src/op/roi_pooling.cpp | 2aac3d9f786ffb4916c05b7fb06b1b62c6fca30b | [
"Apache-2.0"
] | permissive | mashoujiang/openvino | 32c9c325ffe44f93a15e87305affd6099d40f3bc | bc3642538190a622265560be6d88096a18d8a842 | refs/heads/master | 2023-07-28T19:39:36.803623 | 2021-07-16T15:55:05 | 2021-07-16T15:55:05 | 355,786,209 | 1 | 3 | Apache-2.0 | 2021-06-30T01:32:47 | 2021-04-08T06:22:16 | C++ | UTF-8 | C++ | false | false | 5,223 | cpp | roi_pooling.cpp | // Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "ngraph/op/roi_pooling.hpp"
#include "itt.hpp"
using namespace std;
using namespace ngraph;
constexpr NodeTypeInfo op::ROIPooling::type_info;
op::ROIPooling::ROIPooling(const Output<Node>& input,
const Output<Node>& coords,
const Shape& output_size,
const float spatial_scale,
const string& method)
: Op({input, coords})
, m_output_size(output_size)
, m_spatial_scale(spatial_scale)
, m_method(method)
{
constructor_validate_and_infer_types();
}
void op::ROIPooling::validate_and_infer_types()
{
NGRAPH_OP_SCOPE(v0_ROIPooling_validate_and_infer_types);
auto feat_maps_et = get_input_element_type(0);
auto coords_et = get_input_element_type(1);
NODE_VALIDATION_CHECK(
this,
feat_maps_et.is_real() && coords_et.is_real(),
"The data type for input and ROIs is expected to be a floating point type. Got: ",
feat_maps_et,
" and: ",
coords_et);
NODE_VALIDATION_CHECK(
this,
feat_maps_et == coords_et,
"Type of feature maps (inputs) and rois is expected to be the same. Got: ",
feat_maps_et,
" and: ",
coords_et);
NODE_VALIDATION_CHECK(this,
m_output_size.size() == 2,
"The dimension of pooled size is expected to be equal to 2. Got: ",
m_output_size.size());
NODE_VALIDATION_CHECK(this,
m_output_size[0] > 0 && m_output_size[1] > 0,
"Pooled size attributes pooled_h and pooled_w should should be "
"non-negative integers. Got: ",
m_output_size[0],
" and: ",
m_output_size[1],
"respectively");
NODE_VALIDATION_CHECK(
this,
m_spatial_scale > 0,
"The spatial scale attribute should be a positive floating point number. Got: ",
m_spatial_scale);
NODE_VALIDATION_CHECK(
this,
m_method == "max" || m_method == "bilinear",
"Pooling method attribute should be either \'max\' or \'bilinear\'. Got: ",
m_method);
const auto& feat_maps_ps = get_input_partial_shape(0);
NODE_VALIDATION_CHECK(this,
feat_maps_ps.rank().compatible(4),
"Expected a 4D tensor for the feature maps input. Got: ",
feat_maps_ps);
const auto& coords_ps = get_input_partial_shape(1);
NODE_VALIDATION_CHECK(this,
coords_ps.rank().compatible(2),
"Expected a 2D tensor for the ROIs input with box coordinates. Got: ",
coords_ps);
if (coords_ps.rank().is_static())
{
const auto coords_second_dim = coords_ps[1];
NODE_VALIDATION_CHECK(
this,
coords_second_dim.compatible(5),
"The second dimension of ROIs input should contain batch id and box coordinates. ",
"This dimension is expected to be equal to 5. Got: ",
coords_second_dim);
}
// output shape should be {NUM_ROIS, C, pooled_h, pooled_w}
auto output_shape = PartialShape{{Dimension::dynamic(),
Dimension::dynamic(),
Dimension{static_cast<int64_t>(m_output_size[0])},
Dimension{static_cast<int64_t>(m_output_size[1])}}};
if (coords_ps.rank().is_static() && coords_ps[0].is_static())
{
output_shape[0] = coords_ps[0];
}
if (feat_maps_ps.rank().is_static() && feat_maps_ps[1].is_static())
{
output_shape[1] = feat_maps_ps[1];
}
set_output_size(1);
set_output_type(0, feat_maps_et, output_shape);
// if channel dimension, C, not known
// feature maps input is used by shape specialization pass
if (feat_maps_ps.rank().is_static() && feat_maps_ps[1].is_dynamic())
{
set_input_is_relevant_to_shape(0);
}
// if number of ROIs, NUM_ROIS, not known
// coordinate input is used by shape specialization pass
if (coords_ps.rank().is_static() && coords_ps[0].is_dynamic())
{
set_input_is_relevant_to_shape(1);
}
}
shared_ptr<Node> op::ROIPooling::clone_with_new_inputs(const OutputVector& new_args) const
{
NGRAPH_OP_SCOPE(v0_ROIPooling_clone_with_new_inputs);
check_new_args_count(this, new_args);
return make_shared<ROIPooling>(
new_args.at(0), new_args.at(1), m_output_size, m_spatial_scale, m_method);
}
bool op::ROIPooling::visit_attributes(AttributeVisitor& visitor)
{
NGRAPH_OP_SCOPE(v0_ROIPooling_visit_attributes);
visitor.on_attribute("output_size", m_output_size);
visitor.on_attribute("pooled_h", m_output_size[0]);
visitor.on_attribute("pooled_w", m_output_size[1]);
visitor.on_attribute("spatial_scale", m_spatial_scale);
visitor.on_attribute("method", m_method);
return true;
}
|
b8cc4bf3a89bcb498282e109d3b5a75f74f5ebc6 | 64f55ecc66d206771df7c7c6fdc763cd5503690c | /ProyectoQT/inicio.cpp | 907bdc9edda5b74e30c1ec24307ab33f5be006ad | [] | no_license | diegogalarza/Workers-Fund | 0f450f78a793890950da09e2f134285a804c82f5 | 290266293d9d21ba7d7b445fbfa2838ba14df65c | refs/heads/master | 2022-11-10T04:42:15.497280 | 2020-06-28T23:14:52 | 2020-06-28T23:14:52 | 275,667,538 | 0 | 0 | null | null | null | null | ISO-8859-10 | C++ | false | false | 2,042 | cpp | inicio.cpp | #include "inicio.h"
#include "ui_inicio.h"
#include <QMessageBox>
#include <nuevousuario.h>
#include <cuentadelusuario.h>
#include <iostream>
#include <QTextStream>
#include <QFile>
#include <QDebug>
inicio::inicio(QWidget *parent) :
QDialog(parent),
ui(new Ui::inicio)
{
ui->setupUi(this);
}
inicio::~inicio()
{
delete ui;
}
void inicio::on_pushButton_clicked()//boton para iniciar sesion
{
usuario = ui->lineEdit_2-> text();//usa punteros para retornar la info que se escriba en la parte del usuario
contrasena = ui->lineEdit->text();//usa punteros para retornar la info que se escriba en la parte de la contraseņa
if(usuario!="" && contrasena!="")
{
verifica();
}
}
void inicio::on_pushButton_2_clicked()
{
close();
NuevoUsuario nuevoU; //crea el nuevo objeto
nuevoU.setModal(true);//le permite cambiar de ventana
nuevoU.exec();//ejecuta el cambio
}
QStringList inicio::verifica()
{
QString filename = "/Users/juanpablorey/Desktop/Proyecto/usuario5.txt";
QFile file(filename);
file.open(QIODevice::ReadOnly|QIODevice::Text);
QTextStream stream(&file);
QString contenido;
QStringList lista;
while(!file.atEnd()){
contenido=file.readLine();
lista=contenido.split("|");
if(lista[0] == usuario ){
if(lista[1]== contrasena){
//Aqui usiario y contrasena buenas
close();
cuentaDelUsuario cu; //crea el nuevo objeto
cu.setModal(true);//le permite cambiar de ventana
cu.exec();//ejecuta el
}
else{
//Aqui existe el usuario pero la contrasena esta mala
QMessageBox::warning(this,"Error","El usuario o la contraseņa no corresponden, vuelva a intentarlo.");
ui->lineEdit_2->clear();
ui->lineEdit->clear();
}
}
}
file.close();
return lista;
}
|
7006c7bf9174c40fb3ada97fd68e248f2081153c | feb07f2ba98e90064ff2927d35d15b38c6b2ecd4 | /fft_testing/old_testing/array_test.cpp | afaff6cf3b696e2dd09b27a9594df6b79b8e0621 | [] | no_license | wenjiedou/SCGW_2 | 220ba3ae0dc9352de067a240a9c31283ce89756f | b533a7320a54cf6a8075c1ab15a022575481ec8e | refs/heads/master | 2020-08-28T16:50:06.868622 | 2020-01-07T20:16:18 | 2020-01-07T20:16:18 | 217,759,489 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,032 | cpp | array_test.cpp | #include </usr/local/include/fftw3.h>
#include <stdio.h>
#include <math.h>
#include <complex.h>
#include <iostream>
#define NR 100
#define DR 0.12315
#define NT 1000
#define DT 0.1
#define SD 0.1
#define EF 0.25
#define REAL 0
#define IMAG 1
void generate_gaussian_signal(fftw_complex* signal, double* wgrid)
{
double mu;
for (int kk=0; kk<NR; kk++)
{
mu = -5.0+kk*kk*0.01;
for (int ww=0; ww<NT; ww++)
{
double x = wgrid[ww];
signal[ww+NT*kk][REAL] = exp(-(x-mu)*(x-mu)/2.0/SD/SD)/SD/sqrt(2.0*M_PI);
signal[ww+NT*kk][IMAG] = 0.0;
}
}
}
void writefile(fftw_complex* result, double* grid, const int kindex,
std::string fname)
{
FILE *f1;
f1 = fopen(fname.c_str(), "w");
for (int ii=0; ii < NT; ii++)
{
fprintf(f1, "%f %f %f\n", grid[ii], result[ii+NT*kindex][REAL],
result[ii+NT*kindex][IMAG]);
}
fclose(f1);
}
void normalize_results_k(fftw_complex* result)
{
for (int ii=0; ii<NT*NR; ii++)
{
result[ii][REAL] = result[ii][REAL] * DT;
result[ii][IMAG] = result[ii][IMAG] * DT;
}
}
void normalize_results_r(fftw_complex* result)
{
for (int ii=0; ii<NT*NR; ii++)
{
result[ii][REAL] = result[ii][REAL] / NT / DT;
result[ii][IMAG] = result[ii][IMAG] / NT / DT;
}
}
int main(int argc, char const *argv[])
{
const int kstar = 50;
fftw_complex signal[NT*NR];
// Define the grids
double tgrid[NT], wgrid[NT];
for (int ii=0; ii<int(NT/2); ii++)
{
tgrid[ii] = ii * DT;
wgrid[ii] = double(ii * 2 * M_PI / NT / DT);
}
int ccR = 0;
int cc = int(NT/2);
for (int ii=int(NT/2); ii>0; ii--)
{
tgrid[cc] = (-int(NT/2) + ccR) * DT;
wgrid[cc] = -double(ii * 2 * M_PI / NT / DT);
cc++;
ccR++;
}
generate_gaussian_signal(signal, wgrid);
writefile(signal, wgrid, kstar, "test.txt");
fftw_complex *in_forward = (fftw_complex*) fftw_malloc(NT*sizeof(fftw_complex));
fftw_plan forward_plan = fftw_plan_dft_1d(NT, in_forward, in_forward,
FFTW_FORWARD, FFTW_MEASURE);
fftw_complex *in_backward = (fftw_complex*) fftw_malloc(NT*sizeof(fftw_complex));
fftw_plan backward_plan = fftw_plan_dft_1d(NT, in_backward, in_backward,
FFTW_BACKWARD, FFTW_MEASURE);
for(int iGrid=0;iGrid<NR;iGrid++)
{
memcpy(in_backward,&signal[iGrid*NT],NT*sizeof(fftw_complex));
fftw_execute(backward_plan);
memcpy(&signal[iGrid*NT],in_backward,NT*sizeof(fftw_complex));
}
normalize_results_r(signal);
writefile(signal, tgrid, kstar, "test_fft.txt");
for(int iGrid=0;iGrid<NR;iGrid++)
{
memcpy(in_forward,&signal[iGrid*NT],NT*sizeof(fftw_complex));
fftw_execute(forward_plan);
memcpy(&signal[iGrid*NT],in_forward,NT*sizeof(fftw_complex));
}
normalize_results_k(signal);
writefile(signal, wgrid, kstar, "test_fft_recovered.txt");
return 0;
}
|
8e8c2e60a40dffe7ab38b5fcf7c95edb81ef9083 | d50465ac53e46907363b663b286a036afad3128b | /1 WEEK/ver 0.4/UnitTest_calculater/UnitTest_calculater.cpp | 7c499f9a65ee2254434b95a44a571f8ff7dfdbe9 | [] | no_license | dongsub-joung/CPP_Practice | 038f36de005a876307a56c35d39017b1939e1347 | 2351153f6dbd341f5bd32f9802ad02e0ffd98f09 | refs/heads/master | 2022-11-26T21:22:22.360035 | 2020-08-11T19:43:55 | 2020-08-11T19:43:55 | 280,115,434 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,244 | cpp | UnitTest_calculater.cpp | #include "pch.h"
#include "CppUnitTest.h"
#include "../StaticLib_calculater/StaticLib_calculater.cpp"
#include <stdexcept>
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace UnitTestcalculater
{
TEST_CLASS(UnitTestcalculater)
{
public:
Calculator* cal = new Calculator();
TEST_METHOD(TestMethod_ADD)
{
int add = cal->add(3, 5);
Assert::AreEqual(8, add);
delete cal;
}
TEST_METHOD(TestMethod_SUB)
{
int sub = cal->sub(-1, 4);
Assert::AreEqual(-5, sub);
delete cal;
}
TEST_METHOD(TestMethod_DIV)
{
int div = cal->div(4, 2);
Assert::AreEqual(2, div);
delete cal;
}
TEST_METHOD(TestMethod_DIV_ZERO)
{
int a = 4;
int b = 0;
int div = cal->div(a, b);
try
{
if (b == 0) throw b;
Assert::AreEqual(0, div);
delete cal;
}
catch (const std::exception &e)
{
b = 1;
Assert::AreEqual(0, div);
delete cal;
}
}
TEST_METHOD(TestMethod_FACTORIAL)
{
int fac = cal->factorial(4);
Assert::AreEqual(24, fac);
delete cal;
}
TEST_METHOD(TestMethod_FACTORIAL_ZERO)
{
int fac = cal->factorial(-1);
Assert::AreEqual(-1, fac);
delete cal;
}
};
} |
9ed9b0ea204a0a2f549f82de5c892368a18ee565 | b505ef7eb1a6c58ebcb73267eaa1bad60efb1cb2 | /tool/dressing/source/bindobject/colorrect3d.cpp | fcb5c746ee9324fccd489f0cb6b7acdbab511781 | [] | no_license | roxygen/maid2 | 230319e05d6d6e2f345eda4c4d9d430fae574422 | 455b6b57c4e08f3678948827d074385dbc6c3f58 | refs/heads/master | 2021-01-23T17:19:44.876818 | 2010-07-02T02:43:45 | 2010-07-02T02:43:45 | 38,671,921 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,726 | cpp | colorrect3d.cpp | #include"stdafx.h"
#include"colorrect3d.h"
#include"../app.h"
using namespace Maid;
using namespace Sqrat;
void ColorRect3D::Register()
{
RootTable().Bind(
_SC("ColorRect3D"),
DerivedClassEx<ColorRect3D,CppDrawType, ColorRect3DAllocator>()
.SqObject(_SC("Matrix" ), &ColorRect3D::Matrix)
.Var(_SC("CenterX"), &ColorRect3D::CenterX)
.Var(_SC("CenterY"), &ColorRect3D::CenterY)
.Var(_SC("Width" ), &ColorRect3D::Width)
.Var(_SC("Height" ), &ColorRect3D::Height)
.Var(_SC("ColorR" ), &ColorRect3D::ColorR)
.Var(_SC("ColorG" ), &ColorRect3D::ColorG)
.Var(_SC("ColorB" ), &ColorRect3D::ColorB)
.Var(_SC("Alpha" ), &ColorRect3D::Alpha)
);
}
ColorRect3D::ColorRect3D()
:CenterX(0)
,CenterY(0)
,Width(0)
,Height(0)
,ColorR(0)
,ColorG(0)
,ColorB(0)
,Alpha(1)
{
HSQUIRRELVM v = DefaultVM::Get();
MAID_ASSERT( v==NULL, "VMが設定されていません" );
sq_resetobject( &Matrix );
}
ColorRect3D::~ColorRect3D()
{
HSQUIRRELVM v = DefaultVM::Get();
MAID_ASSERT( v==NULL, "VMが設定されていません" );
const SQBool drawtype = sq_release( v, &Matrix );
}
static const MATRIX4DF idx( MATRIX4DF().SetIdentity() );
void ColorRect3D::Draw( float time, const Maid::POINT3DF& pos )
{
const POINT3DF center(CenterX,CenterY,0);
const SIZE2DI size(Width,Height);
const COLOR_R32G32B32A32F col(ColorR,ColorG,ColorB,Alpha);
const CppMatrix* p = (const CppMatrix*)sq_objtoinstance(&Matrix);
const MATRIX4DF& mat = p==NULL? idx : p->GetMatrix();
const MATRIX4DF t = mat * MATRIX4DF().SetTranslate( pos.x, pos.y, pos.z );
GetApp().Get3DRender().SpriteFill( t, col, size, center );
}
|
5c90e890ee655fd0bfd6f9cf633f257dd28ea203 | a18898bce8afba8ff6107413745239c447ee55b5 | /04/ex01/Character.hpp | 619cbf8167817a4ece95e180982d8f5c57b3cbd8 | [] | no_license | nesvoboda/piscine_cpp | 7d19b6783b51787fbc4f5085fb71a6ae407f93f0 | 854cb7062b175c6631147a95a954de8cfe0bdeeb | refs/heads/master | 2022-12-30T21:25:06.599826 | 2020-10-20T10:42:42 | 2020-10-20T10:42:42 | 286,800,642 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,505 | hpp | Character.hpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Character.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ashishae <ashishae@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/09/01 13:48:33 by ashishae #+# #+# */
/* Updated: 2020/09/16 19:29:44 by ashishae ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef CHARACTER_HPP
# define CHARACTER_HPP
# include <string>
# include "Enemy.hpp"
# include "AWeapon.hpp"
class Character
{
private:
int ap;
AWeapon *current_weapon;
std::string name;
Character();
public:
Character(std::string const &name);
Character(const Character ©);
Character &operator= (const Character &operand);
~Character();
void recoverAP();
void equip(AWeapon *);
void attack(Enemy*);
std::string const &getName() const;
int getAP() const;
std::string getWeaponName() const;
int hasWeapon() const;
};
std::ostream &operator<< (std::ostream &os, Character &operand);
#endif |
a1b7b0d337ed04790cc6b6d73945ddaabd8b39f5 | 701058ad6dc8464f3a1cf2ca00acfd917d71a49d | /backup.cc | 9eb1232a782cc9cdf4c53b5271f3624c3613c048 | [] | no_license | twampseoul/kupakupa | 9e785e214c8d22619ac56b6c8cfbafb3193a4be7 | 0669efc2c0a8a6b664af0f2fe7967fc3e24067dd | refs/heads/master | 2021-01-24T11:22:01.557479 | 2016-10-22T02:36:53 | 2016-10-22T02:36:53 | 70,223,485 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 22,379 | cc | backup.cc | #include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/dce-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/internet-module.h"
#include "ns3/flow-monitor-module.h"
#include "ns3/flow-monitor-helper.h"
#include <string>
#include <sstream>
#include <vector>
#include <iostream>
#include <fstream>
#include <iostream>
#include <map>
#include "parseXml.h"
using namespace ns3;
using namespace std;
NS_LOG_COMPONENT_DEFINE ("kupakupa");
//function to turn interger to string for iperf input
string DoubleToString (double a)
{
ostringstream temp;
temp<<a;
return temp.str();
}
void GenerateHtmlFile (int fileSize)
{
std::ofstream myfile;
myfile.open ("files-2/index.html");
myfile << "<http>\n <body>\n";
std::vector<char> empty(1024, 0);
for(int i = 0; i < 1024*fileSize; i++)
{
if (!myfile.write(&empty[0], empty.size()))
{
std::cerr << "problem writing to file" << std::endl;
}
}
myfile << "Dummy html file\n";
myfile << "</body>\n</http>\n";
myfile.close();
}
//fungtion to get the last value in tcp_mem for tcp_mem_max
string SplitLastValue (const std::string& str)
{
//std::cout << "Splitting: " << str << '\n';
unsigned found = str.find_last_of(" ");
ostringstream temp;
temp << str.substr(found+1);
return temp.str();
}
//to remove comma if user make input with comma
string RemoveComma (std::string& str)
{
//std::cout << "test : " << str << '\n';
int i = 0;
std::string str2=str;
for (i=0; i<3; i++)
{
std::size_t found=str.find(',');
if (found!=std::string::npos) {
str2 = str.replace(str.find(','),1," ");
} else {
//std::cout<<"no comma found.."<<std::endl;
}
}
return str2;
}
static void RunIp (Ptr<Node> node, Time at, std::string str)
{
DceApplicationHelper process;
ApplicationContainer apps;
process.SetBinary ("ip");
process.SetStackSize (1 << 16);
process.ResetArguments ();
process.ParseArguments (str.c_str ());
apps = process.Install (node);
apps.Start (at);
}
void
PrintTcpFlags (std::string key, std::string value)
{
NS_LOG_INFO (key << "=" << value);
}
int main (int argc, char *argv[])
{
double errRate = 0.001;
std::string tcp_cc = "reno";
std::string tcp_mem_user = "4096 8192 8388608";
std::string tcp_mem_user_wmem = "4096 8192 8388608";
std::string tcp_mem_user_rmem = "4096 8192 8388608";
std::string tcp_mem_server = "4096 8192 8388608";
std::string tcp_mem_server_wmem = "4096 8192 8388608";
std::string tcp_mem_server_rmem = "4096 8192 8388608";
std::string udp_bw="1";
std::string delay = "2ms";
std::string user_bw = "150Mbps";
std::string server_bw = "10Gbps";
int jitter =1;
double alpha = 0;
double mean = 0;
double variance = 0;
int monitor = 1;
int mode = 0;
int ErrorModel = 1;
double SimuTime = 50;
int htmlSize = 2; // in mega bytes
char TypeOfConnection = 'p'; // iperf tcp connection
bool downloadMode = true;
bool inputFromXml = false;
/*
unsigned int chan_jitter = 1;
double chan_alpha = 0.3;
double chan_variance = 2;
double chan_k = 5;
*/
CommandLine cmd;
cmd.AddValue ("inputFromXml", "flag for reading input from xml file",inputFromXml);
cmd.AddValue ("TypeOfConnection", "Link type: p for iperf-tcp, u for iperf-udp and w for wget-thttpd, default to iperf-tcp", TypeOfConnection);
cmd.AddValue ("ModeOperation", "If true it's download mode for UE, else will do upload. http will always do download", downloadMode);
cmd.AddValue ("tcp_cc", "TCP congestion control algorithm. Default is reno. Other options: bic, cubic, highspeed, htcp, hybla, illinois, lp, probe, scalable, vegas, veno, westwood, yeah", tcp_cc);
cmd.AddValue ("tcp_mem_user", "put 3 values (min, default, max) separaed by comma for tcp_mem in user, range 4096-16000000", tcp_mem_user);
cmd.AddValue ("tcp_mem_user_wmem", "put 3 values (min, default, max) separaed by comma for tcp_mem in user, range 4096-16000000", tcp_mem_user_wmem);
cmd.AddValue ("tcp_mem_user_rmem", "put 3 values (min, default, max) separaed by comma for tcp_mem in user, range 4096-16000000", tcp_mem_user_rmem);
cmd.AddValue ("tcp_mem_server", "put 3 values (min, default, max) separaed by comma for tcp_mem in server, range 4096-54000000", tcp_mem_server);
cmd.AddValue ("tcp_mem_server_wmem", "put 3 values (min, default, max) separaed by comma for tcp_mem in server, range 4096-54000000", tcp_mem_server_wmem);
cmd.AddValue ("tcp_mem_server_rmem", "put 3 values (min, default, max) separaed by comma for tcp_mem in server, range 4096-54000000", tcp_mem_server_rmem);
cmd.AddValue ("user_bw", "bandwidth between user and BS, in Mbps. Default is 150", user_bw);
cmd.AddValue ("server_bw", "bandwidth between server and BS, in Gbps. Default is 10", server_bw);
cmd.AddValue ("delay", "Delay.", delay);
cmd.AddValue ("errRate", "Error rate.", errRate);
cmd.AddValue ("ErrorModel", "Choose error model you want to use. options: 1 -rate error model-default, 2 - burst error model", ErrorModel);
cmd.AddValue ("udp_bw","banwidth set for UDP, default is 1M", udp_bw);
cmd.AddValue ("htmlSize","banwidth set for UDP, default is 1M", htmlSize);
cmd.AddValue ("SimuTime", "time to do the simulaton, in second", SimuTime);
cmd.AddValue ("chan_jitter", "jitter in server-BS conection", jitter);
cmd.AddValue ("chan_alpha", "alpha for random distribution in server-BS conection", alpha);
cmd.AddValue ("chan_variance", "variance for normal random distribution in server-BS conection", variance);
cmd.AddValue ("chan_mean", " Normal random distribution mean in server-BS conection", mean);
cmd.Parse (argc, argv);
if (inputFromXml)
{
string fileName = "inputDCE.xml";
ParseInput parser;
parser.parseInputXml(fileName,TypeOfConnection,tcp_cc,udp_bw,delay,SimuTime,downloadMode,errRate,jitter,alpha,mean,variance, ErrorModel, user_bw, server_bw, htmlSize,tcp_mem_user, tcp_mem_user_wmem,tcp_mem_user_rmem, tcp_mem_server, tcp_mem_server_wmem, tcp_mem_server_rmem);
}
TypeOfConnection = tolower (TypeOfConnection);
switch (TypeOfConnection)
{
case 'u': //iperf udp connection
std::cout << "IPERF-UDP connection is selected" << std::endl;
break;
case 'w': //thttpd - wget connection, always in download mode
std::cout << "HTTP connection is selected" << std::endl;
break;
case 'p': //thttpd - wget connection, always in download mode
std::cout << "IPERF-TCP connection is selected" << std::endl;
break;
default:
std::cout << "Unknown link type : " << TypeOfConnection << " ?" << std::endl;
//return 1;
}
// topologies
std::cout << "Building topologies.." << std::endl;
NS_LOG_INFO ("Create nodes.");
NodeContainer c;
c.Create (3);
NodeContainer n0n1 = NodeContainer (c.Get (0), c.Get (1));
NodeContainer n1n2 = NodeContainer (c.Get (1), c.Get (2));
DceManagerHelper dceManager;
std::cout << "Setting memory size.." << std::endl;
//setting memory size for user and server
#ifdef KERNEL_STACK
dceManager.SetNetworkStack ("ns3::LinuxSocketFdFactory", "Library", StringValue ("liblinux.so"));
LinuxStackHelper stack;
stack.Install (c);
dceManager.Install (c);
//let's remove the comma
tcp_mem_user = RemoveComma(tcp_mem_user);
tcp_mem_user_wmem = RemoveComma(tcp_mem_user_wmem);
tcp_mem_user_rmem = RemoveComma(tcp_mem_user_rmem);
tcp_mem_server = RemoveComma(tcp_mem_server);
tcp_mem_server_wmem = RemoveComma(tcp_mem_server_wmem);
tcp_mem_server_rmem = RemoveComma(tcp_mem_server_rmem);
//assume coma has been removed
std::string tcp_mem_user_max_wmem = SplitLastValue(tcp_mem_server_wmem);
std::string tcp_mem_user_max_rmem = SplitLastValue(tcp_mem_server_rmem);
std::string tcp_mem_server_max_wmem = SplitLastValue(tcp_mem_server_wmem);
std::string tcp_mem_server_max_rmem = SplitLastValue(tcp_mem_server_rmem);
if (TypeOfConnection=='w')
{
std::cout << "Generating html file with size =" << htmlSize <<"Mbytes" << std::endl;
mkdir ("files-2",0744);
GenerateHtmlFile(htmlSize);
SimuTime=100;
if (htmlSize*1000 > atoi(tcp_mem_user_max_wmem.c_str())){
double tmp2=atof(tcp_mem_user_max_wmem.c_str())/(htmlSize*1000);
SimuTime = (htmlSize*10)/(tmp2)*1.5*(htmlSize/tmp2);
}
}
std::string IperfTime = DoubleToString(SimuTime);
stack.SysctlSet (c.Get(0), ".net.ipv4.tcp_mem", tcp_mem_user);
stack.SysctlSet (c.Get(0), ".net.ipv4.tcp_wmem", tcp_mem_user_wmem);
stack.SysctlSet (c.Get(0), ".net.ipv4.tcp_rmem", tcp_mem_user_rmem);
stack.SysctlSet (c.Get(0), ".net.core.wmem_max", tcp_mem_user_max_wmem);
stack.SysctlSet (c.Get(0), ".net.core.rmem_max", tcp_mem_user_max_rmem);
stack.SysctlSet (c.Get(0), ".net.core.netdev_max_backlog", "250000");
stack.SysctlSet (c.Get(2), ".net.ipv4.tcp_mem", tcp_mem_server);
stack.SysctlSet (c.Get(2), ".net.ipv4.tcp_wmem", tcp_mem_server_wmem);
stack.SysctlSet (c.Get(2), ".net.ipv4.tcp_rmem", tcp_mem_server_rmem);
stack.SysctlSet (c.Get(2), ".net.core.wmem_max", tcp_mem_server_max_wmem);
stack.SysctlSet (c.Get(2), ".net.core.rmem_max", tcp_mem_server_max_rmem);
stack.SysctlSet (c.Get(2), ".net.core.netdev_max_backlog", "250000");
stack.SysctlSet (c, ".net.ipv4.tcp_congestion_control", tcp_cc);
#else
NS_LOG_ERROR ("Linux kernel stack for DCE is not available. build with dce-linux module.");
//silently exit
return 0;
#endif
std::cout << "Setting link.." << std::endl;
if (downloadMode) {
std::cout << "Download mode is used "<< std::endl;
mode = 0;
}
if (!downloadMode) {
std::cout << "Upload mode is used "<< std::endl;
mode = 1;
}
// channel for user to BS
NS_LOG_INFO ("Create channels.");
PointToPointHelper p2p;
p2p.SetDeviceAttribute ("DataRate", StringValue (user_bw));
p2p.SetChannelAttribute ("Delay", StringValue ("0"));
p2p.SetChannelAttribute ("monitor", UintegerValue (monitor));
p2p.SetChannelAttribute ("mode",UintegerValue (mode));
NetDeviceContainer d0d1 = p2p.Install (n0n1);
//channel for server to BS
p2p.SetDeviceAttribute ("DataRate", StringValue (server_bw));
p2p.SetChannelAttribute ("Delay", StringValue (delay));
p2p.SetChannelAttribute ("Jitter", UintegerValue (1));
p2p.SetChannelAttribute ("alpha", DoubleValue (alpha));
p2p.SetChannelAttribute ("mean", DoubleValue (mean));
p2p.SetChannelAttribute ("variance", DoubleValue (variance));
p2p.SetChannelAttribute ("monitor", UintegerValue (monitor));
p2p.SetChannelAttribute ("mode",UintegerValue (mode) );
NetDeviceContainer d1d2 = p2p.Install (n1n2);
//error model options
/*strangely, if em is not set at the begining, it doesn't want to compile.
therefore, i just put it here as a default object and to make sure it can
be build properly*/
Ptr<RateErrorModel> em = CreateObjectWithAttributes<RateErrorModel> (
"RanVar", StringValue ("ns3::UniformRandomVariable[Min=0.0,Max=1.0]"),
"ErrorRate", DoubleValue (errRate),
"ErrorUnit", EnumValue (RateErrorModel::ERROR_UNIT_PACKET)
);
std::cout << "Building error model..." <<std::endl;
if (ErrorModel == 1)
{
std::cout << "Rate Error Model is selected"<<std::endl;
Ptr<RateErrorModel> em = CreateObjectWithAttributes<RateErrorModel> (
"RanVar", StringValue ("ns3::UniformRandomVariable[Min=0.0,Max=1.0]"),
"ErrorRate", DoubleValue (errRate),
"ErrorUnit", EnumValue (RateErrorModel::ERROR_UNIT_PACKET)
);
std::cout << "Building error model completed" <<std::endl;
}
else if (ErrorModel==2)
{
std::cout << "Burst Error Model is selected" <<std::endl;
Ptr<BurstErrorModel> em = CreateObjectWithAttributes<BurstErrorModel> (
"BurstSize", StringValue ("ns3::UniformRandomVariable[Min=1,Max=4]"),
"BurstStart", StringValue ("ns3::UniformRandomVariable[Min=0.0|Max=1.0]"),
"ErrorRate", DoubleValue (errRate)
);
std::cout << "Building error model completed" <<std::endl;
}
else
{
//this will not change the error model
std::cout << "Unknown error model. Restore to default: rate error model" <<std::endl;
}
// IP Address
NS_LOG_INFO ("Assign IP Addresses.");
std::cout << "Setting IP addresses" << std::endl;
Ipv4AddressHelper ipv4;
//for client and BS net devices
ipv4.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer i0i1 = ipv4.Assign (d0d1);
//for server and BS devices
ipv4.SetBase ("10.1.2.0", "255.255.255.0");
Ipv4InterfaceContainer i1i2 = ipv4.Assign (d1d2);
// Create router nodes, initialize routing database and set up the routing tables in the nodes.
std::cout << "Creating routing table" << std::endl;
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
#ifdef KERNEL_STACK
LinuxStackHelper::PopulateRoutingTables ();
#endif
// Application
NS_LOG_INFO ("Create Applications.");
std::cout << "Creating Applications.." << std::endl;
DceApplicationHelper dce;
dce.SetStackSize (1 << 20);
int EndTime = 2*SimuTime;;
if (EndTime<=100) {
EndTime=100;
}
switch (TypeOfConnection)
{
case 'p':
{
if (downloadMode)
{
d1d2.Get(0)-> SetAttribute ("ReceiveErrorModel", PointerValue (em));
// Launch iperf server on node 0 (mobile device)
dce.SetBinary ("iperf");
dce.ResetArguments ();
dce.ResetEnvironment ();
dce.AddArgument ("-s");
dce.AddArgument ("-P");
dce.AddArgument ("1");
ApplicationContainer SerApps0 = dce.Install (c.Get (0));
SerApps0.Start (Seconds (1));
//SerApps0.Stop (Seconds (SimuTime+(SimuTime*25/100)));
// Launch iperf client on node 2
dce.SetBinary ("iperf");
dce.ResetArguments ();
dce.ResetEnvironment ();
dce.AddArgument ("-c");
dce.AddArgument ("10.1.1.1");
dce.AddArgument ("-i");
dce.AddArgument ("1");
dce.AddArgument ("--time");
dce.AddArgument (IperfTime);
ApplicationContainer ClientApps0 = dce.Install (c.Get (2));
ClientApps0.Start (Seconds (1));
//ClientApps0.Stop (Seconds (SimuTime+(SimuTime*25/100)));
}
else
{
d1d2.Get(1)-> SetAttribute ("ReceiveErrorModel", PointerValue (em));
// Launch iperf server on node 2
// server will receive tcp message
dce.SetBinary ("iperf");
dce.ResetArguments ();
dce.ResetEnvironment ();
dce.AddArgument ("-s");
dce.AddArgument ("-P");
dce.AddArgument ("1");
ApplicationContainer SerApps0 = dce.Install (c.Get (2));
SerApps0.Start (Seconds (1));
//SerApps0.Stop (Seconds (SimuTime+(SimuTime*25/100)));
// Launch iperf client on node 0
dce.SetBinary ("iperf");
dce.ResetArguments ();
dce.ResetEnvironment ();
dce.AddArgument ("-c");
dce.AddArgument ("10.1.2.2");
dce.AddArgument ("-i");
dce.AddArgument ("1");
dce.AddArgument ("--time");
dce.AddArgument (IperfTime);
ApplicationContainer ClientApps0 = dce.Install (c.Get (0));
ClientApps0.Start (Seconds (1));
//ClientApps0.Stop (Seconds (SimuTime+(SimuTime*25/100)));
}
}
break;
case 'u':
{
if (downloadMode)
{
d1d2.Get(0)-> SetAttribute ("ReceiveErrorModel", PointerValue (em));
// Launch iperf udp server on node 0
dce.SetBinary ("iperf");
dce.ResetArguments ();
dce.ResetEnvironment ();
dce.AddArgument ("-s");
dce.AddArgument ("-u");
dce.AddArgument ("-P");
dce.AddArgument ("1");
ApplicationContainer SerApps0 = dce.Install (c.Get (0));
SerApps0.Start (Seconds (1));
//SerApps0.Stop (Seconds (SimuTime+(SimuTime*25/100)));
// Launch iperf client on node 2
dce.SetBinary ("iperf");
dce.ResetArguments ();
dce.ResetEnvironment ();
dce.AddArgument ("-c");
dce.AddArgument ("10.1.1.1");
dce.AddArgument ("-u");
dce.AddArgument ("-i");
dce.AddArgument ("1");
dce.AddArgument ("-b");
dce.AddArgument (udp_bw+"m");
dce.AddArgument ("--time");
dce.AddArgument (IperfTime);
ApplicationContainer ClientApps0 = dce.Install (c.Get (2));
ClientApps0.Start (Seconds (1));
//ClientApps0.Stop (Seconds (SimuTime+(SimuTime*25/100)));
}
else
{
d1d2.Get(1)-> SetAttribute ("ReceiveErrorModel", PointerValue (em));
// Launch iperf udp server on node 0
dce.SetBinary ("iperf");
dce.ResetArguments ();
dce.ResetEnvironment ();
dce.AddArgument ("-s");
dce.AddArgument ("-u");
dce.AddArgument ("-i");
dce.AddArgument ("1");
ApplicationContainer SerApps0 = dce.Install (c.Get (2));
SerApps0.Start (Seconds (1));
//SerApps0.Stop (Seconds (SimuTime+(SimuTime*25/100)));
// Launch iperf client on node 2
dce.SetBinary ("iperf");
dce.ResetArguments ();
dce.ResetEnvironment ();
dce.AddArgument ("-c");
dce.AddArgument ("10.1.2.2");
dce.AddArgument ("-u");
dce.AddArgument ("-i");
dce.AddArgument ("1");
dce.AddArgument ("-b");
dce.AddArgument (udp_bw+"m");
dce.AddArgument ("--time");
dce.AddArgument (IperfTime);
ApplicationContainer ClientApps0 = dce.Install (c.Get (0));
ClientApps0.Start (Seconds (1));
//ClientApps0.Stop (Seconds (SimuTime+(SimuTime*25/100)));
}
}
break;
case 'w':
{
downloadMode=true;
d1d2.Get(0)-> SetAttribute ("ReceiveErrorModel", PointerValue (em));
dce.SetBinary ("thttpd");
dce.ResetArguments ();
dce.ResetEnvironment ();
dce.SetUid (1);
dce.SetEuid (1);
ApplicationContainer serHttp = dce.Install (c.Get (2));
serHttp.Start (Seconds (1));
dce.SetBinary ("wget");
dce.ResetArguments ();
dce.ResetEnvironment ();
dce.AddArgument ("-r");
dce.AddArgument ("http://10.1.2.2/index.html");
ApplicationContainer clientHttp = dce.Install (c.Get (0));
clientHttp.Start (Seconds (1));
}
break;
default:
{
// Launch iperf server on node 0
d1d2.Get(0)-> SetAttribute ("ReceiveErrorModel", PointerValue (em));
dce.SetBinary ("iperf");
dce.ResetArguments ();
dce.ResetEnvironment ();
dce.AddArgument ("-s");
dce.AddArgument ("-P");
dce.AddArgument ("1");
ApplicationContainer SerApps0 = dce.Install (c.Get (0));
SerApps0.Start (Seconds (1));
//SerApps0.Stop (Seconds (SimuTime+(SimuTime*25/100)));
// Launch iperf client on node 2
dce.SetBinary ("iperf");
dce.ResetArguments ();
dce.ResetEnvironment ();
dce.AddArgument ("-c");
dce.AddArgument ("10.1.1.1");
dce.AddArgument ("-i");
dce.AddArgument ("1");
dce.AddArgument ("--time");
dce.AddArgument (IperfTime);
ApplicationContainer ClientApps0 = dce.Install (c.Get (2));
ClientApps0.Start (Seconds (1));
//ClientApps0.Stop (Seconds (SimuTime+(SimuTime*25/100)));
}
break;
}
/*for (int n = 0; n < 3; n++)
{
RunIp (c.Get (n), Seconds (0.2), "link show");
RunIp (c.Get (n), Seconds (0.3), "route show table all");
RunIp (c.Get (n), Seconds (0.4), "addr list");
}*/
// print tcp sysctl value
//LinuxStackHelper::SysctlGet (c.Get (0), Seconds (1.0),".net.ipv4.tcp_available_congestion_control", &PrintTcpFlags);
/*LinuxStackHelper::SysctlGet (c.Get (0), Seconds (1),".net.ipv4.tcp_congestion_control", &PrintTcpFlags);
LinuxStackHelper::SysctlGet (c.Get (0), Seconds (1),".net.ipv4.tcp_congestion_control", &PrintTcpFlags);
LinuxStackHelper::SysctlGet (c.Get (0), Seconds (1),".net.ipv4.tcp_rmem", &PrintTcpFlags);
LinuxStackHelper::SysctlGet (c.Get (0), Seconds (1),".net.ipv4.tcp_wmem", &PrintTcpFlags);
LinuxStackHelper::SysctlGet (c.Get (0), Seconds (1),".net.core.rmem_max", &PrintTcpFlags);
LinuxStackHelper::SysctlGet (c.Get (0), Seconds (1),".net.core.wmem_max", &PrintTcpFlags);
//LinuxStackHelper::SysctlGet (c.Get (2), Seconds (1),".net.ipv4.tcp_available_congestion_control", &PrintTcpFlags);
LinuxStackHelper::SysctlGet (c.Get (2), Seconds (1),".net.ipv4.tcp_congestion_control", &PrintTcpFlags);
LinuxStackHelper::SysctlGet (c.Get (2), Seconds (1),".net.ipv4.tcp_rmem", &PrintTcpFlags);
LinuxStackHelper::SysctlGet (c.Get (2), Seconds (1),".net.ipv4.tcp_wmem", &PrintTcpFlags);
LinuxStackHelper::SysctlGet (c.Get (2), Seconds (1),".net.core.rmem_max", &PrintTcpFlags);
LinuxStackHelper::SysctlGet (c.Get (2), Seconds (1),".net.core.wmem_max", &PrintTcpFlags);
*/
AsciiTraceHelper ascii;
p2p.EnableAsciiAll (ascii.CreateFileStream ("Kupakupa.tr"));
p2p.EnablePcapAll ("kupakupa");
NS_LOG_INFO ("Run Simulation.");
//std::cout << "Simulation will take about "<< (SimuTime) <<"seconds." << std::endl;
Simulator::Stop (Seconds (EndTime));
Simulator::Run ();
std::cout << "Simulation is completed" << std::endl;
Simulator::Destroy ();
NS_LOG_INFO ("Done.");
return 0;
}
|
66fada9e0230e75a802ff4165a9d2682af07e8fc | efd37293b5be7e21dd9a1a9f578507cd68277746 | /cf_edu_112.cpp | a4422e189f476e2891d51da9c970a3915fe1fc35 | [] | no_license | kushalgandhi26/cp-codeforces | cfc724c45a1373f92e7714ed418ec4db05d3c12d | 0ac0f33fbce00a1686bfadeb3f67d41ac0aa9b01 | refs/heads/main | 2023-08-16T06:08:10.464401 | 2021-10-11T06:30:05 | 2021-10-11T06:30:05 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,187 | cpp | cf_edu_112.cpp | #include <bits/stdc++.h>
#define YES cout << "YES\n"
#define NO cout << "NO\n"
#define endl "\n"
// #define int long long
typedef long long ll;
#define forp(i, x, t) for (int i = x; i < t; i++)
#define forn(i, x, t) for (int i = x; i > t; i--)
#define deb(x) cout << #x << " = " << x << endl
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
const int mod = 1e9 + 7;
using namespace std;
int power(int x, int y)
{
int res = 1;
if (x == 0)
return 0;
while (y > 0)
{
if (y & 1)
res = (res * x);
y = y >> 1;
x = (x * x);
}
return res;
}
bool is_prime(ll n)
{
if (n == 1)
{
return false;
}
int i = 2;
while (i * i <= n)
{
if (n % i == 0)
{
return false;
}
i += 1;
}
return true;
}
int nCr(int n, int r)
{
long long p = 1, k = 1;
if (n - r < r)
r = n - r;
if (r != 0)
{
while (r)
{
p *= n;
k *= r;
long long m = __gcd(p, k);
p /= m;
k /= m;
n--;
r--;
}
}
else
p = 1;
return p;
}
bool sortbysec(const pair<int, int> &a,
const pair<int, int> &b)
{
return (a.second < b.second);
}
string toBinary(int n)
{
string r;
while (n != 0)
{
r = (n % 2 == 0 ? "0" : "1") + r;
n /= 2;
}
return r;
}
void solve(int in)
{
int w,h;
cin>>w>>h;
int x1,y1,x2,y2;
cin>>x1>>y1>>x2>>y2;
int w2,h2;
cin>>w2>>h2;
//w - (x2-x1) < h2 && h - (y2-y1) < w2 &&
if(w - (x2-x1) < w2 && h - (y2-y1) < h2){
cout<<-1<<endl;
return;
}
int ans = INT_MAX;
if(w - (x2-x1) >= w2){
int t = w - x2, t2 = x1;
ans = min(w2 - min(w2,t), w2 - min(w2,x1));
}
// deb(ans);
if(h- (y2-y1) >= h2){
int t = h - y2, t2 = y1;
ans = min(ans,min(h2 - min(h2,t), h2 - min(h2,y1)));
}
cout<<ans<<endl;
}
void solve2(int in){
int ans = INT_MAX;
int m;
cin>>m;
int a[2][m];
forp(i,0,2)
{
forp(j,0,m){
cin>>a[i][j];
}
}
int pref[m+1] = {0}, suf[m+1] = {0};
forp(i,0,m){
pref[i+1] = pref[i] + a[1][i];
}
forn(i,m-1,-1){
suf[i] = suf[i+1] + a[0][i];
}
forp(i,0,m){
ans = min(ans,max(suf[i+1], pref[i]));
}
cout<<ans<<endl;
}
void solve3(int in){
int n,m;
cin>>n>>m;
string s;
cin>>s;
int pref[6][n+1];
forp(i,0,6){
forp(j,0,n+1){
pref[i][j] = 0;
}
}
string arr[6] = {"abc","acb", "bac", "bca", "cab", "cba"};
forp(i,0,6){
forp(j,0,n){
pref[i][j+1] = pref[i][j] + (s[j] != arr[i][j%3]);
}
}
forp(i,0,m){
int x,y;
cin>>x>>y;
int ans = INT_MAX;
forp(j,0,6){
ans = min(ans,pref[j][y] - pref[j][x-1]);
}
cout<<ans<<endl;
}
}
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t = 1;
forp(i, 1, t + 1)
{
solve3(i);
}
return 0;
} |
1778ddd107d016a1700e76b90d0bad4dcb83e418 | a1b7f3cdb35ca6d051a1d1e4e83296687580f4a0 | /Core/Common/REParser.h | 9ff720c4b77f8965b1ceaeccf9c7f50baf72a0f9 | [] | no_license | keithbugeja/meson | ca1afc32d170bc16a712387f797d202322896267 | fe81e1d74d35d37609b22b692366efc95fbfc61d | refs/heads/master | 2021-03-27T19:51:13.811968 | 2012-10-01T21:57:23 | 2012-10-01T21:57:23 | 87,206,597 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,503 | h | REParser.h | #pragma once
//----------------------------------------------------------------------------------------------
//
//
//----------------------------------------------------------------------------------------------
// Author Date Version Description
//----------------------------------------------------------------------------------------------
// Gordon Mangion 07/09/2007 1.0.0 Initial version.
//----------------------------------------------------------------------------------------------
#include "RENode.h"
Meson_Common_RegularExpressions_BEGIN
class REParser
{
private:
RENode *m_pRegExp;
public:
REParser( void );
~REParser( void );
bool Parse( const char *p_pszRegExp );
bool Parse( Meson::Common::Text::String &p_strRegExp );
RENode *GetRegularExpression( void );
Meson::Common::Text::String GetExpression( void );
private:
int ParseNumber( Meson::Common::Text::String &p_strRegExp );
int ParseHex( Meson::Common::Text::String &p_strRegExp );
RENode *ParseEscape( Meson::Common::Text::String &p_strRegExp );
bool ParseParenthesis( RENode *p_pNode, Meson::Common::Text::String &p_strRegExp );
RENode *ParseBraces( Meson::Common::Text::String &p_strRegExp );
RENode *ParseBrackets( Meson::Common::Text::String &p_strRegExp );
bool ParseExpression( RENode *p_pNode, Meson::Common::Text::String &p_strRegExp );
RENode *ParseExpressions( Meson::Common::Text::String &p_strRegExp );
};
Meson_Common_RegularExpressions_END
|
afcaa15094dcb14c6bce467cea7f41e2d23077a0 | cdb52ce16c2652d03974ed943ecbb266dde9e1a0 | /source_code/main.hpp | fff526fdab7b9a93967a024a6fcf4e37fed2fada | [] | no_license | matcha-scoft/Campus-Navigation-System | 3510484a929f880d6fbebd3b196903f6a8883256 | 5fd8e533f2315c072cc232b0b50e3f9f5d6cb504 | refs/heads/main | 2023-05-29T00:11:46.769684 | 2021-06-13T02:00:12 | 2021-06-13T02:00:12 | 344,715,614 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,136 | hpp | main.hpp | #ifndef main_hpp
#define main_hpp
#include <sys/select.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <cstring>
#include <iomanip>
#include <unistd.h>
#include <queue>
#include <fstream>
const int NODEONE = 93; //校区一建筑物,服务设施,路口总数
const int NODETWO = 38; //校区二建筑物,服务设施,路口总数
const int EDGEONE = 286; //校区一道路总数
const int EDGETWO = 118; //校区二道路总数
const int INF = 0x3f3f3f3f;
const bool pulse_ = 1; //是否中断标记
using namespace std;
//时间结构
class Time {
public:
int h, m; //维护到小时分钟
};
//时钟结构
class Clock
{
public:
Clock(){}; //构造函数
void SetTime(int newH = 0, int newM = 0); //时间初始化
void ShowTime(); //显示时间
void Run(); //Run()控制计时,真实的一秒表示两分钟
void Run(int ); //公交车,班车计时,真实的一秒表示十分钟
int getH(); //返回私有成员hour
int getM(); //返回私有成员minute
private:
int hour, minute; //小时,分钟
};
//边结构
class Edge {
public:
int num; //编号
double dis; //距离
int direct; //方向,0,1,2,3表示四个方向
bool pass; //可否通行自行车,0为不可通行,1为可通行
double k; //拥挤程度,小于等于1的小数,实际速度等于速度乘以拥挤程度
int u, v; //连接u,v节点,由u指向v的有向边
};
//节点结构
class Node {
public:
int num; //节点编号
string name; //名称
};
//保存用户所在位置信息的结构
class Pos {
public:
bool state; //用户位置的状态,在节点上(在某一建筑物或服务设施上)则为0,在边上则为1
string pos; //state为0时保存用户所在节点的name
int pos_num; //state为1时保存用户所在边的下标
int campus_num; //保存用户所在校区
double dis; //state为1时保存用户距离前方节点的距离
//flag初始化时为0,当系统获得用户输入得到用户最初位置后设置为1,设置为1后系统自行维护用户位置,不需用户再次输入所在位置
bool flag;
Pos() {
flag = false; //构造函数初始化flag
}
//更新用户当前状态信息,表示用户在一个节点上,state置0,pos为用户所在节点name,campus为用户所在校区数,传入时钟维护写入文件的时间
void up(string pos , int campus, Clock my_clock) {
flag = true; //flag始终置1
campus_num = campus; //更新校区数
this -> pos = pos; //更新所在节点name
state = 0; //更新state
//用户信息写入log文件
ofstream ofs;
ofs.open("log.txt", ios::app);
ofs << "当前时间" << my_clock.getH() << "时" << my_clock.getM() << "分,";
ofs << "用户位于校区" << campus << "的" << pos << endl;
ofs.close();
}
//重构,更新用户当前状态信息,表示用户在一条边上,state置1,pos_num为用户所在边的下标,campus为用户所在校区数,dis为用户距离此条边终点的距离
void up(int pos_num, int campus, double dis, Clock my_clock) {
flag = true;
this -> pos_num = pos_num; //更新用户所在边下标
campus_num = campus;
this -> dis = dis; //更新距离
state = 1; //更新state
//写入log文件
ofstream ofs;
ofs.open("log.txt", ios::app);
ofs << "当前时间" << my_clock.getH() << "时" << my_clock.getM() << "分,";
ofs << "用户位于校区" << campus << "的" << pos_num / 2 + 1 << "号道路上,距离前方目标" << dis << "米" << endl;
ofs.close();
}
//重构,表示用户在班车或公交车上,bus为0表示在公交车上,bus为1表示在定点班车上
void up(int bus, Clock my_clock) {
flag = true;
//写入文件
ofstream ofs;
ofs.open("log.txt", ios::app);
ofs << "当前时间" << my_clock.getH() << "时" << my_clock.getM() << "分,";
if (bus == 0) {
ofs << "用户正在乘坐公交车" << endl;
}
else {
ofs << "用户正在乘坐定点班车" << endl;
}
ofs.close();
}
};
//进入系统,参数为校区一,二的节点数组和边数组,用户位置信息,同步时钟,定点班车时间表
void StartSystem(vector<Node> & , vector<Edge> & , vector<Node> & , vector<Edge> & , Pos & , Clock & , vector<Time> );
//初始化校区一,参数为校区一的节点数组和边数组(传引用)
void InitOne(vector<Node> & , vector<Edge> &);
//初始化校区二,参数为校区二的节点数组和边数组(传引用)
void InitTwo(vector<Node> & , vector<Edge> &);
//校区一初始化辅助函数,已知每条边的起点,计算每条边的终点
void ChangeUVOne(int[] , int* );
//校区二初始化辅助函数
void ChangeUVTwo(int[] , int* );
//初始化定点班车发车时刻表
void InitTimeTable(vector<Time> & );
//查询系统,参数为用户位置信息,用户所在校区的节点数组,边数组,时钟信息用来写入文件
void Inquire(Pos , vector<Node> , vector <Edge> , Clock );
//单校区导航系统,参数为所在校区的节点和边,用户位置信息,起点名称,所有终点的名称,时钟
bool NavigationInOneCampus(vector<Node> & , vector<Edge> & , Pos & , string , vector<string> , Clock & );
//跨校区导航系统,参数为两校区的节点和边,用户位置信息,起点名称,所有终点名称(跨校区不支持多终点),时钟,定点班车表
void NavigationInTwoCampus(vector<Node> & , vector<Edge> & , vector<Node> & , vector<Edge> & , Pos & , string , vector<string> , Clock & , vector<Time> );
//计算最短距离,时间,自行车策略最短路径,参数为节点数,边数,起点下标,从起点到每个节点的最短距离数组,路径维护数组,用户所在校区的边数组
void ShortestPath(int , int , int , double * , int * , vector<Edge> );
//多目的地最短路径,不维护任意两目的地之间的具体路径,只维护整体多目的地的路径,参数为起点下标,终点下标集合,全图任意两节点之间的最短路径,整体路径
void ShortestMultiplePath(int , vector<int> , int [][300], vector<int> & );
//中断
bool pulse(Pos , vector<Node> , vector <Edge> , Clock );
#endif /* main_hpp */
|
e2ed62d234f0a3252cc998be6e0e2f0e781345c6 | 846473d51eae33d967257c7c2d6e66961062a302 | /MyStacksMin.h | 6aafc73f1c9e2f7098e8c5b2bb69e657ff6820ef | [] | no_license | eaglesky/careercup | d025fbd10d2197822706c265ec17889bc666ad14 | 779a501ef758a3f9f0fe4e41893e13a74df6616d | refs/heads/master | 2021-01-22T06:43:56.338579 | 2015-07-04T06:02:26 | 2015-07-04T06:02:26 | 7,771,108 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 1,287 | h | MyStacksMin.h | #include "MyStacks.h"
template <class T>
class ArrayStackMin : public ArrayStack<T> {
public:
ArrayStackMin(int size = 10);
~ArrayStackMin(){ delete min_stack; }
bool Push(const T &data);
bool Pop(T &data);
bool GetMin(T *pmin);
void ShowMin();
private:
T *min_stack;
int min_top;
};
template <class T>
ArrayStackMin<T>::ArrayStackMin(int size) : ArrayStack<T>(size)
{
min_stack = new T[size];
min_top = -1;
}
template <class T>
bool ArrayStackMin<T>::Push(const T &data)
{
if (!ArrayStack<T>::Push(data))
return false;
if (min_top > -1) {
if (data <= min_stack[min_top]) {
min_top++;
min_stack[min_top] = data;
}
} else {
min_top++;
min_stack[min_top] = data;
}
return true;
}
template <class T>
bool ArrayStackMin<T>::Pop(T &data)
{
if (!ArrayStack<T>::Pop(data))
return false;
if (data == min_stack[min_top])
min_top--;
return true;
}
template <class T>
bool ArrayStackMin<T>::GetMin(T *pmin)
{
if (ArrayStack<T>::IsEmpty())
return false;
*pmin = min_stack[min_top];
return true;
}
template <class T>
void ArrayStackMin<T>::ShowMin()
{
std::cout << "Min Stack:" << std::endl;
for (int i = 0; i <= min_top; i++)
std::cout << min_stack[i] << " ";
std::cout << std::endl;
}
|
9a9e40295bb33d98aea7c158996b204ac8f49f63 | d0fcb7beb33b0cef5455ffb155b4d4ea51f75f37 | /LinearRegression/MLinearRegressionModel.h | 6bc8b6362f39aa34d4b2fb225f40f42189e04a8a | [] | no_license | Wojtechnology/ML | 5145fd9f1ea4045a8baf51278dbee1a7795ec558 | 2abf4323399a9f67102916164a35dbc150747b24 | refs/heads/master | 2020-04-17T20:18:05.554935 | 2017-01-14T20:32:15 | 2017-01-14T20:32:15 | 66,301,941 | 0 | 0 | null | 2016-10-14T08:18:46 | 2016-08-22T19:29:32 | C++ | UTF-8 | C++ | false | false | 704 | h | MLinearRegressionModel.h | #ifndef M_LINEAR_REGRESSION_MODEL_H
#define M_LINEAR_REGRESSION_MODEL_H
#include <Eigen/Dense>
#include "../Common/IRegressionModel.h"
// Multivariate Linear Regression model for float type values
class MLinearRegressionModel : public IRegressionModel<float> {
public:
explicit MLinearRegressionModel(
unsigned int n,
bool normalize = true,
float alpha = 1,
unsigned int iterations = 1,
float lambda = 1) :
IRegressionModel(n, normalize, alpha, iterations, lambda) { }
private:
void train_(const Eigen::MatrixXf &x, const Eigen::VectorXf &y) override;
float predict_(const Eigen::VectorXf &x) const override;
};
#endif
|
0f64fcdbe01887b0fd7dc8ce19efd0650fa4624e | 9affad254e5199cbd0aa5899a1a85a877d596199 | /BZEngine/Window.cpp | 377fc9261069c18ff42a5919c439d8b83ec8e9cb | [
"MIT"
] | permissive | ZacharyPuls/BZEngine | 376620111007141870db30dd6189de6e60f2a2d7 | 7005c1130bff0b1d988a6b59ec6c07d668266df6 | refs/heads/master | 2021-07-11T21:43:07.075974 | 2020-07-25T19:38:30 | 2020-07-25T19:38:30 | 185,699,986 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,128 | cpp | Window.cpp | #include "Window.h"
#include <utility>
Window::Window(): window_(nullptr), width_(640), height_(480)
{
std::clog << "[DEBUG] GLWindow::GLWindow()" << std::endl;
}
Window::Window(std::string title, const int width, const int height): window_(nullptr), title_(std::move(title)),
width_(width),
height_(height)
{
std::clog << "[DEBUG] GLWindow::GLWindow(...)" << std::endl;
}
Window::~Window()
{
std::clog << "[DEBUG] GLWindow::~GLWindow()" << std::endl;
if (window_) {
glfwSetWindowUserPointer(window_, nullptr);
glfwDestroyWindow(window_);
}
}
void Window::Create()
{
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 6);
window_ = glfwCreateWindow(width_, height_, title_.c_str(), nullptr, nullptr);
if (!window_)
{
std::cerr << "Could not create GLFW window." << std::endl;
}
MakeContextCurrent();
glfwSwapInterval(1);
}
void Window::SwapBuffers() const
{
MakeContextCurrent();
glfwSwapBuffers(window_);
}
int Window::GetMouseButton(const int button) const
{
return glfwGetMouseButton(window_, button);
}
bool Window::IsFocused() const
{
return glfwGetWindowAttrib(window_, GLFW_FOCUSED) != 0;
}
void Window::SetCursorPos(const double x, const double y) const
{
glfwSetCursorPos(window_, x, y);
}
Point2D Window::GetCursorPos() const
{
double x;
double y;
glfwGetCursorPos(window_, &x, &y);
return { x, y };
}
void Window::SetInputMode(const int mode, const int value) const
{
glfwSetInputMode(window_, mode, value);
}
int Window::GetInputMode(const int mode) const
{
return glfwGetInputMode(window_, mode);
}
void Window::SetCursor(GLFWcursor* cursor) const
{
glfwSetCursor(window_, cursor);
}
Point2Di Window::GetWindowSize() const
{
int width;
int height;
glfwGetWindowSize(window_, &width, &height);
return { width, height };
}
Point2Di Window::GetFramebufferSize() const
{
int width;
int height;
glfwGetFramebufferSize(window_, &width, &height);
return { width, height };
}
bool Window::ShouldClose() const
{
return glfwWindowShouldClose(window_);
}
void Window::MakeContextCurrent() const
{
glfwMakeContextCurrent(window_);
}
void Window::PollEvents()
{
glfwPollEvents();
}
GLFWwindow* Window::GetPointer() const
{
return window_;
}
void Window::SetUserPointer(void* ptr) const
{
glfwSetWindowUserPointer(window_, ptr);
}
void Window::SetCursorPosCallback(GLFWcursorposfun callback) const
{
glfwSetCursorPosCallback(window_, callback);
}
void Window::SetMouseButtonCallback(GLFWmousebuttonfun callback) const
{
glfwSetMouseButtonCallback(window_, callback);
}
void Window::SetKeyCallback(GLFWkeyfun callback) const
{
glfwSetKeyCallback(window_, callback);
}
void Window::SetCharCallback(GLFWcharfun callback) const
{
glfwSetCharCallback(window_, callback);
}
void Window::SetDropCallback(GLFWdropfun callback) const
{
glfwSetDropCallback(window_, callback);
}
void Window::SetScrollCallback(GLFWscrollfun callback) const
{
glfwSetScrollCallback(window_, callback);
}
void Window::SetFramebufferSizeCallback(GLFWframebuffersizefun callback) const
{
glfwSetFramebufferSizeCallback(window_, callback);
}
void Window::InstallCallbacks() const
{
static auto cursorPosCallback = [&](GLFWwindow *window, const double x, const double y)
{
};
SetCursorPosCallback([](GLFWwindow *window, const double x, const double y)
{
cursorPosCallback(window, x, y);
});
static auto mouseButtonCallback = [&](GLFWwindow *window, const int button, const int action, const int modifiers)
{
};
SetMouseButtonCallback([](GLFWwindow *window, const int button, const int action, const int modifiers)
{
mouseButtonCallback(window, button, action, modifiers);
});
static auto keyCallback = [&](GLFWwindow *window, const int key, const int scancode, const int action, const int modifiers)
{
};
SetKeyCallback([](GLFWwindow *window, const int key, const int scancode, const int action, const int modifiers)
{
keyCallback(window, key, scancode, action, modifiers);
});
static auto charCallback = [&](GLFWwindow *window, const unsigned int codepoint)
{
};
SetCharCallback([](GLFWwindow *window, const unsigned int codepoint)
{
charCallback(window, codepoint);
});
static auto dropCallback = [&](GLFWwindow *window, const int count, const char **filenames)
{
};
SetDropCallback([](GLFWwindow *window, const int count, const char **filenames)
{
dropCallback(window, count, filenames);
});
static auto scrollCallback = [&](GLFWwindow *window, const double x, const double y)
{
};
SetScrollCallback([](GLFWwindow *window, const double x, const double y)
{
scrollCallback(window, x, y);
});
static auto framebufferSizeCallback = [&](GLFWwindow *window, const int width, const int height)
{
};
SetFramebufferSizeCallback([](GLFWwindow *window, const int width, const int height)
{
framebufferSizeCallback(window, width, height);
});
}
void Window::Close() const
{
glfwSetWindowShouldClose(window_, GLFW_TRUE);
}
|
99bdf160904e6e12ec52d9cca12635cf4538fd4b | c3a8dde74127361474d3b136146cab6ec201e5e8 | /bohater.cpp | 61ff2941c8f6db3a202cd6015590c13faad22fe6 | [
"MIT"
] | permissive | Patryk707/Commando_Battle | 7205a1d88025123c0ff83dc522e525f97de9330f | 91da154e103d5db405b7111831f6010157a77bc5 | refs/heads/main | 2023-06-08T20:42:14.384537 | 2021-06-28T15:05:02 | 2021-06-28T15:05:02 | 373,184,879 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,322 | cpp | bohater.cpp | #include "bohater.h"
#include "pocisk.h"
Bohater::Bohater(Vector2f& position,Vector2f &scale,float left, float right, float top, float bottom) {
setPosition(position);
setScale(scale);
setBounds(left,right,top,bottom);
setTextureRect({0, 0, texture_size.x, texture_size.y});
setOrigin(float(texture_size.x) / 2, float(texture_size.y) / 2);
}
void Bohater::setSpeed(float x, float y) {
speed_x = x;
speed_y = y;
}
void Bohater::setFacing(bool f) {
facing = f;
}
bool Bohater::getFacing() {
return facing;
}
void Bohater::setBounds(float left, float right, float top, float bottom) {
left_borderline = left;
right_borderline = right;
top_borderline = top;
bottom_borderline = bottom;
}
void Bohater::bounce() {
if (getGlobalBounds().top <= top_borderline) {
speed_y = abs(speed_y);
} else if (getGlobalBounds().top + getGlobalBounds().height >= bottom_borderline) {
speed_y = -abs(speed_y);
} else if (getGlobalBounds().left <= left_borderline) {
speed_x = abs(speed_x);
} else if (getGlobalBounds().left + getGlobalBounds().width >= right_borderline) {
speed_x = -abs(speed_x);
}
}
void Bohater::shoot() {
Pocisk nowy_pocisk(Vector2f(20, 20), getFacing(),false);
nowy_pocisk.set_position(Vector2f(getPosition().x, getPosition().y));
Pocisk::wystrzelone_pociski.emplace_back(nowy_pocisk);
}
void Bohater::animate(const Time& elapsed, const vector<shared_ptr<Platforma>>& platforms, Clock& jump_cooldown) {
float sec = elapsed.asSeconds();
if (Keyboard::isKeyPressed(Keyboard::Key::A) && getGlobalBounds().left > left_borderline) {
speed_x = -difficulty_level::bohater_speed;
setScale(-2.5, 2.5);
setFacing(false);
is_running = true;
} else if (Keyboard::isKeyPressed(Keyboard::Key::D) &&
getGlobalBounds().left + getGlobalBounds().width < right_borderline) {
speed_x = difficulty_level::bohater_speed;
setScale(2.5, 2.5);
setFacing(true);
is_running = true;
} else {
speed_x = 0;
is_running = false;
}
if (Keyboard::isKeyPressed(Keyboard::Key::W) && getGlobalBounds().top > top_borderline &&
jump_cooldown.getElapsedTime().asSeconds() >= 1) {
speed_y = -700;
jump_cooldown.restart();
}
speed_y += 3000 * sec;
float potential_x = speed_x * sec;
float potential_y = speed_y * sec;
if (!is_running) {
setTexture(static_john_texture());
setTextureRect({0, 0, 26, 22});
} else {
if (animation_clock.getElapsedTime().asSeconds() >= frame_duration) {
animated_hero_texture();
animation_clock.restart();
}
}
bool kolizja_pozioma = false;
bool kolizja_pionowa = false;
for (const shared_ptr<Platforma>& platform : platforms) {
if (czy_pozioma_kolizja(potential_x, *platform) and !czy_stoi_na(*platform)) {
kolizja_pozioma = true;
}
if (czy_pionowa_kolizja(potential_y, *platform)) {
kolizja_pionowa = true;
}
bool stoi_na_innej = false;
for (const shared_ptr<Platforma>& platform2 : platforms) {
if (platform.get() != platform2.get() && czy_stoi_na(*platform2)) {
stoi_na_innej = true;
}
}
if (czy_stoi_na(*platform) && platform->platforma_ruszajaca && !stoi_na_innej) {
move({0, platform->speed_y * sec});
}
}
if (!kolizja_pozioma) {
move({potential_x, 0});
}
if (!kolizja_pionowa) {
move({0, potential_y});
} else {
speed_y = 0;
}
bounce();
}
void Bohater::animated_hero_texture() {
setTexture(running_john_texture());
current_texture++;
if (current_texture == frame_count) current_texture = 0;
setTextureRect({current_texture * texture_size.x, 0, texture_size.x, texture_size.y});
}
void Bohater::add_lives(int l) {
lives += l;
}
bool Bohater::is_alive() {
if (lives > 0) {
return true;
} else {
return false;
}
}
bool Bohater::czy_pozioma_kolizja(float potential_x, const Platforma& obiekt) {
return getGlobalBounds().left + potential_x <= obiekt.getGlobalBounds().left + obiekt.getGlobalBounds().width &&
getGlobalBounds().left + getGlobalBounds().width + potential_x >= obiekt.getGlobalBounds().left &&
!(getGlobalBounds().top >= obiekt.getGlobalBounds().top + obiekt.getGlobalBounds().height ||
getGlobalBounds().top + getGlobalBounds().height <= obiekt.getGlobalBounds().top);
}
bool Bohater::czy_pionowa_kolizja(float potential_y, const Platforma& obiekt) {
return getGlobalBounds().top + potential_y <= obiekt.getGlobalBounds().top + obiekt.getGlobalBounds().height &&
getGlobalBounds().top + getGlobalBounds().height + potential_y >= obiekt.getGlobalBounds().top &&
!(getGlobalBounds().left >= obiekt.getGlobalBounds().left + obiekt.getGlobalBounds().width ||
getGlobalBounds().left + getGlobalBounds().width <= obiekt.getGlobalBounds().left);
}
bool Bohater::czy_stoi_na(const Platforma& obiekt) {
return getGlobalBounds().top - 0.1 <= obiekt.getGlobalBounds().top + obiekt.getGlobalBounds().height &&
getGlobalBounds().top + getGlobalBounds().height + 0.1 >= obiekt.getGlobalBounds().top &&
!(getGlobalBounds().left >= obiekt.getGlobalBounds().left + obiekt.getGlobalBounds().width ||
getGlobalBounds().left + getGlobalBounds().width <= obiekt.getGlobalBounds().left);
}
bool Bohater::check_collision(Sprite& bonus) {
if (getGlobalBounds().intersects(bonus.getGlobalBounds())) {
return true;
} else {
return false;
}
}
bool Bohater::chec_collision(Bonus& medal) {
if (getGlobalBounds().intersects(medal.getGlobalBounds())) {
return true;
} else {
return false;
}
}
void Bohater::add_points(int p) {
points += p;
}
bool Bohater::win(Bonus& medal) {
if (points >= 6 && chec_collision(medal)) {
return true;
} else {
return false;
}
}
void Bohater::set_points(int p){
points=p;
}
int Bohater::get_lives(){
return lives;
}
void Bohater::set_lives(int l){
lives=l;
}
|
198bfbd1a9ac7f696184571539b5406bbdd5ae89 | 75c7b727db06faff1f62871cc25a45995fc2a31b | /solverILP/src/disjoint-paths/disjointPathsPython.cxx | fbfc8fd1b15ecc4102b10b22f328879a081f1a45 | [] | no_license | AndreaHor/LifT_Solver | 3288eeab0a7d5d4379348febafeeeda0a28ac129 | 1b8462d5659563473557e7939d7e2b9d01b629c6 | refs/heads/master | 2023-03-02T02:04:07.312343 | 2021-02-02T12:20:41 | 2021-02-02T12:20:41 | 273,190,411 | 60 | 10 | null | null | null | null | UTF-8 | C++ | false | false | 3,970 | cxx | disjointPathsPython.cxx | /*
* disjointPathsPython.cxx
*
* Created on: Jul 7, 2020
* Author: fuksova
*/
#include <pybind11/pybind11.h>
#include "disjoint-paths/disjointParams.hxx"
//#include "disjoint-paths/disjointPathsMethods.hxx"
#include "disjoint-paths/ilp/solver-disjoint-ilp.hxx"
//#include "disjoint-paths/completeStructure.hxx"
#include <string>
namespace py = pybind11;
PYBIND11_MODULE(disjointPathsPy, m) {
m.doc() = "python binding for lifted disjoint paths";
py::class_<disjointPaths::ParametersParser>(m,"ParametersParser")
.def(py::init<>())
.def("get_parsed_params",&disjointPaths::ParametersParser::getParsedStrings,"getting the parsed strings from parser")
.def("init_from_file", py::overload_cast<std::string&>(&disjointPaths::ParametersParser::initFromFile),"Parses parameters from a file");
// .def("init_from_stream",&disjointPaths::ParametersParser::initFromStream<std::stringstream>,"Parses parameters from a stream");
py::class_<disjointPaths::DisjointParams<>>(m, "DisjointParams")
.def(py::init<std::map<std::string,std::string>&>());
py::class_<disjointPaths::VertexGroups<>>(m, "TimeFramesToVertices")
.def(py::init<>())
.def("init_from_vector", &disjointPaths::VertexGroups<>::initFromVector, "Initializes vertices in time frames from a vector of size_t")
.def("init_from_file", &disjointPaths::VertexGroups<>::initFromFile<disjointPaths::DisjointParams<>>, "Initializes vertices in time frames from a file");
py::class_<disjointPaths::CompleteStructure<>>(m, "GraphStructure")
.def(py::init<disjointPaths::VertexGroups<> &>())
.def("add_edges_from_array", &disjointPaths::CompleteStructure<>::addEdgesFromMatrix, "Initializes edges of the graph between two time frames from a matrix.")
.def("add_edges_from_vectors", &disjointPaths::CompleteStructure<>::addEdgesFromVectors<disjointPaths::DisjointParams<>>, "Initializes edges of the graph from an Nx2 array of size_t with edge vertices and an Nx1 array of doubles with costs. Restrictions on maximal vertex and maximal time gap from parameters apply.")
.def("add_edges_from_vectors_all", &disjointPaths::CompleteStructure<>::addEdgesFromVectorsAll, "Initializes edges of the graph from an Nx2 array of size_t with edge vertices and an Nx1 array of doubles with costs. All edges added. No restriction on maximal timegap. ")
.def("add_edges_from_file", &disjointPaths::CompleteStructure<>::addEdgesFromFile<disjointPaths::DisjointParams<>>, "Initializes all edges of the graph from a file.")
.def("get_edge_labels",&disjointPaths::CompleteStructure<>::getGraphEdgeLabels,"Returns 0/1 labels of all input edges w.r.t. given set of paths. Label one is given iff detections belong to the same path." )
.def("get_edge_list",&disjointPaths::CompleteStructure<>::getEdgeList,"Return list of edges present in this graph structure.");
// m.def("solve_ilp", py::overload_cast<disjointPaths::DisjointParams<>&, disjointPaths::CompleteStructure<>&>(&disjointPaths::solver_ilp_intervals<>), "Solve lifted disjoint paths");
m.def("solve_ilp", &disjointPaths::solver_ilp<>, "Solve lifted disjoint paths");
m.def("write_output_to_file", &disjointPaths::writeOutputToFile, "Write output tracks to a specified file");
m.def("solve_standard_disjoit_paths", &disjointPaths::solver_flow_only<>, "Solve standard disjoint paths problem");
m.def("get_base_edge_labels",&disjointPaths::getBaseEdgeLabels<std::vector<std::array<size_t,2>>>,"Given a vector of base edge vertices, vector of solution paths and the number of graph vertices, it returns labels to base edges.");
m.def("get_lifted_edge_labels",&disjointPaths::getLiftedEdgeLabels<std::vector<std::array<size_t,2>>>,"Given a vector of lifted edge vertices, vector of solution paths and the number of graph vertices, it returns labels to base edges.");
}
|
63b3faee718584980ed2a667eef1d6b92e3d7a55 | 9eda8cae792a48a01f1a09040e7ec104cb7c3336 | /Classes/TeamManager.h | ebb5425b09baafb7d443d2068298286028030b39 | [] | no_license | Niassy/ShipAndTower | a135b3fd3f6be95f0314cc1f8be6e1216646f7bf | dcfff774d71358daa8a23c4df62d3e0ea712da58 | refs/heads/master | 2021-01-19T20:23:02.842200 | 2017-04-17T12:13:22 | 2017-04-17T12:13:22 | 88,501,817 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,455 | h | TeamManager.h |
#ifndef TEAMMANAGER
#define TEAMMANAGER
#pragma warning (disable:4786)
//------------------------------------------------------------------------
//
// Name: TeamManager.h
//
// Desc: Singleton class to handle the management of Team.
//
// Author: Mat Buckland 2002 (fup@ai-junkie.com)
//
//------------------------------------------------------------------------
#include <map>
#include <cassert>
#include <string>
class Team;
//provide easy access
#define TeamMngr TeamManager::Instance()
class TeamManager
{
private:
typedef std::map<int, Team*> TeamMap;
private:
//to facilitate quick lookup the entities are stored in a std::map, in which
//pointers to entities are cross referenced by their identifying number
TeamMap m_TeamMap;
TeamManager(){}
//copy ctor and assignment should be private
TeamManager(const TeamManager&);
TeamManager& operator=(const TeamManager&);
public:
static TeamManager* Instance();
//this method stores a pointer to the Team in the std::vector
//m_Entities at the index position indicated by the Team's ID
//(makes for faster access)
void RegisterTeam(Team* NewTeam);
//returns a pointer to the Team with the ID given as a parameter
Team* GetTeamFromID(int id)const;
//this method removes the Team from the list
void RemoveTeam(Team* pTeam);
void Reset() {
m_TeamMap.clear();
}
};
#endif
|
5408a52b3b8507e0e8d4bd677734df410f0c8de9 | e7bad21ba5c28c9fb0f1c91021541388bac3efad | /SumoChocadores/Juego/SumosChocadoresPlay.h | b9714c579b29ffe60709b77d08038094601b8450 | [] | no_license | More997/EngineMM-y-Sumo-Chocadores | 4e6dc11af89af87caef5380ec7d706068fdf005a | 36491bc7a4c8f5aed8bae04d8538f395d8212b7b | refs/heads/master | 2020-12-30T16:57:11.680583 | 2019-11-12T20:42:43 | 2019-11-12T20:42:43 | 90,981,497 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,517 | h | SumosChocadoresPlay.h | #ifndef SUMOSCHOCADORESPLAY_H
#define SUMOSCHOCADORESPLAY_H
#include "../EngineMM/ConectorDeEngine.h"
#include "../EngineMM/Animacion.h"
//#include "../EngineMM/Camera.h"
//#include "../EngineMM/Tilemap.h"
#include "../EngineMM/MeshRender.h"
#include "../EngineMM/SceneImporter.h"
#include "../EngineMM/TileRenderer.h"
#include "../EngineMM/Tileset.h"
//#include "../EngineMM/Textura.h"
/*#include "Perseguidor.h"
#include "Jugador.h"*/
class SumosChocadoresPlay :
public ConectorDeEngine
{
private:
Composite* comCam;
Camera* camara;
LPD3DXEFFECT shaderEffect;
Game* game;
float numx = 0;
float numy = 0;
float numz = 1.5f;
Mesh* cosoMesh2;
Textura* cosoTex2;
MeshRender* cosoRender2;
Composite*coso2;
Mesh* cosoMesh;
Textura* cosoTex;
MeshRender* cosoRender;
Composite*coso;
Composite* root;
SceneImporter* sceneImp;
Tileset* tileSet;
TileRenderer* tileRender;
BoundingBox* bbTiles;
int canttiles;
int canttiles2;
BoundingBox bbtest;
Composite* enemigo;
Animacion * animacionEnemigo;
Mesh* meshEnemigo;
Textura* texEnemigo;
/*Jugador* pj;
Animacion * animacionPj;
Mesh* meshPj;
Textura* texPj;
bool gameover;
*/
Input *gameInput;
map<string, vector<int>> reciverMap;
vector<int> *intVectorInputUp;
vector<int> *intVectorInputLeft;
vector<int> *intVectorInputRight;
vector<int> *intVectorInputDown;
vector<int> *intVectorInputU;
vector<int> *intVectorInputI;
//float vel;
public:
SumosChocadoresPlay();
~SumosChocadoresPlay();
void Create();
void Update();
};
#endif
|
fb807bc248741514a038a32e9c126fd97d5dd281 | 2a8a290eb1d0703a7c7b21429b07870c5ffa868e | /Include/NiDynamicEffectStateManager.h | af8a97a9943413b1f22518d29fd81685d54c03dc | [] | no_license | sigmaco/gamebryo-v32 | b935d737b773497bf9e663887e326db4eca81885 | 0709c2570e21f6bb06a9382f9e1aa524070f3751 | refs/heads/master | 2023-03-31T13:56:37.844472 | 2021-04-17T02:30:46 | 2021-04-17T02:30:46 | 198,067,949 | 4 | 4 | null | 2021-04-17T02:30:47 | 2019-07-21T14:39:54 | C++ | UTF-8 | C++ | false | false | 2,645 | h | NiDynamicEffectStateManager.h | // EMERGENT GAME TECHNOLOGIES PROPRIETARY INFORMATION
//
// This software is supplied under the terms of a license agreement or
// nondisclosure agreement with Emergent Game Technologies and may not
// be copied or disclosed except in accordance with the terms of that
// agreement.
//
// Copyright (c) 1996-2009 Emergent Game Technologies.
// All Rights Reserved.
//
// Emergent Game Technologies, Calabasas, CA 91302
// http://www.emergent.net
#pragma once
#ifndef NIDYNAMICEFFECTSTATEMANAGER_H
#define NIDYNAMICEFFECTSTATEMANAGER_H
#include "NiMainLibType.h"
#include "NiBool.h"
#include "NiRefObject.h"
#include "NiSmartPointer.h"
#include "NiDynamicEffect.h"
#include "NiRTLib.h"
#include "NiTPointerMap.h"
#include "NiTPool.h"
class NiDynamicEffectState;
class NIMAIN_ENTRY NiDynamicEffectStateManager : public NiMemObject
{
public:
enum
{
DEFAULT_MAP_SIZE = 257,
DEFAULT_LIST_ENTRY_POOL_SIZE = 256
};
inline void ResizeMap(NiUInt32 uiPrimeSize);
// *** begin Emergent internal use only ***
static void _SDMInit();
static void _SDMShutdown();
static inline NiDynamicEffectStateManager* GetEffectManager();
NiDynamicEffectStateManager();
virtual ~NiDynamicEffectStateManager();
void AddDynamicEffectState(NiDynamicEffectStatePtr& spEffectState);
bool RemoveDynamicEffectState(NiDynamicEffectState* pkEffectState);
// Lock access to the effect state map
void LockManager();
// Unlock access to the effect state map
void UnlockManager();
class NIMAIN_ENTRY ListEntry : public NiMemObject
{
public:
ListEntry* m_pkNext;
NiDynamicEffectState* m_pkEffectState;
};
// *** end Emergent internal use only ***
protected:
NiDynamicEffectState* CreateNewEffectState(NiDynamicEffectState* pkParentState,
NiDynamicEffectList* pkEffectList);
NiTPointerMap<NiUInt32, ListEntry*>* m_pkEffectStateMap;
NiTObjectPool<ListEntry>* m_pkListEntryPool;
// Critical section used to proctect access to the effect state map and
// the entry pool. This critical section is locked:
// -When an NiDynamiceEffected is added via AddDynamicEffectState()
// -When an NiDynamiceEffected is removed via RemoveDynamicEffectState()
// -When the EffectStateMap is resized via ResizeMap()
efd::CriticalSection m_kEffectStateCriticalSection;
static NiDynamicEffectStateManager* ms_pkDynamicEffectStateManager;
};
#include "NiDynamicEffectStateManager.inl"
#endif // NIDYNAMICEFFECTSTATEMANAGER_H |
ea7e9ceda7e23446fc7b69a354c2ec45cdc12348 | 3aae1bfe7d51f7d9479430766fb0910a35a7e953 | /src/PythonDef.cpp | 448a6fa74d4bd0be3982bc8a3a4581ac8068ad2f | [
"MIT"
] | permissive | renewang/HexGame | 69bcfbbf542f1bcb154461321dfbabb0898af54e | 21d271091c0b09dd701e1d7b61673ab944e7d45b | refs/heads/master | 2016-09-06T21:54:46.788719 | 2014-04-10T18:10:26 | 2014-04-10T18:10:26 | 18,365,382 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,269 | cpp | PythonDef.cpp | /*
* PythonDef.cpp
* This file defines the interface which can be used for python language and also a wrapper for Hex Game
*/
#include <boost/python.hpp>
#include "Game.h"
#include "Player.h"
#include "HexBoard.h"
#include "Strategy.h"
#include "AbstractStrategy.h"
using namespace boost::python;
/**
* HexGamePyEngine
*/
class HexGamePyEngine {
public:
#if __cplusplus > 199711L
HexGamePyEngine(unsigned numofhexgon)
: board(HexBoard(numofhexgon)),
redplayer(Player(board, hexgonValKind::RED)),
blueplayer(Player(board, hexgonValKind::BLUE)),
hexboardgame(Game(board)) {
}
#else
HexGamePyEngine(unsigned numofhexgon)
: board(HexBoard(numofhexgon)),
redplayer(Player(board, RED)),
blueplayer(Player(board, BLUE)),
hexboardgame(Game(board)) {
}
#endif
~HexGamePyEngine() {
}
bool setRedPlayerMove(int indexofhexgon) {
if (indexofhexgon) {
int row = (indexofhexgon - 1) / board.getNumofhexgons() + 1;
int col = (indexofhexgon - 1) % board.getNumofhexgons() + 1;
return hexboardgame.setMove(redplayer, row, col);
}
return false;
}
bool setBluePlayerMove(int indexofhexgon) {
if (indexofhexgon) {
int row = (indexofhexgon - 1) / board.getNumofhexgons() + 1;
int col = (indexofhexgon - 1) % board.getNumofhexgons() + 1;
return hexboardgame.setMove(blueplayer, row, col);
}
return false;
}
int genRedPlayerMove() {
return hexboardgame.genMove(*aistrategy['R']);
}
int genBluePlayerMove() {
return hexboardgame.genMove(*aistrategy['B']);
}
void showView() {
std::string view = hexboardgame.showView(redplayer, blueplayer);
/* string alphabets = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for(int i = 1; i <= board.getNumofhexgons(); ++i)
view.replace(to_string(i), std::string(alphabets[i-1]));*/
std::cout << view << '\n';
}
std::string getWinner() {
return hexboardgame.getWinner(redplayer, blueplayer);
}
unsigned getNumofhexgons() {
return board.getNumofhexgons();
}
void setNumofhexgons(unsigned numofhexgon) {
board.setNumofhexgons(numofhexgon);
}
hexgonValKind getNodeValue(int indexofhexgon) {
return board.getNodeValue(indexofhexgon);
}
void resetGame() {
hexboardgame.resetGame(redplayer, blueplayer);
}
void setRedPlayerStrategy(AIStrategyKind strategykind) {
selectStrategy(strategykind, redplayer);
}
void setBluePlayerStrategy(AIStrategyKind strategykind) {
selectStrategy(strategykind, blueplayer);
}
private:
HexBoard board;
Player redplayer; //north to south, 'O'
Player blueplayer; //west to east, 'X'
Game hexboardgame;
hexgame::unordered_map<char, hexgame::shared_ptr<AbstractStrategy> > aistrategy;
void selectStrategy(AIStrategyKind strategykind, Player& player) {
hexgame::unique_ptr<AbstractStrategy,
hexgame::default_delete<AbstractStrategy> > transformer(nullptr);
::selectStrategy(strategykind, transformer, player, board);
aistrategy.insert(
make_pair(player.getViewLabel(),
hexgame::shared_ptr<AbstractStrategy>(transformer.release())));
}
};
BOOST_PYTHON_MODULE(libhexgame)
{
enum_<hexgonValKind>("hexgonValKind").value("EMPTY", hexgonValKind_EMPTY)
.value("RED", hexgonValKind_RED)
.value("BLUE", hexgonValKind_BLUE);
enum_<AIStrategyKind>("AIStrategyKind")
.value("NAIVE", AIStrategyKind_NAIVE)
.value("MCST", AIStrategyKind_MCTS)
.value("PMCST", AIStrategyKind_PMCTS);
class_<HexGamePyEngine>("HexGamePyEngine", init<unsigned>())
.def("showView", &HexGamePyEngine::showView)
.def("setRedPlayerMove", &HexGamePyEngine::setRedPlayerMove)
.def("setBluePlayerMove", &HexGamePyEngine::setBluePlayerMove)
.def("genRedPlayerMove", &HexGamePyEngine::genRedPlayerMove)
.def("genBluePlayerMove", &HexGamePyEngine::genBluePlayerMove)
.def("getWinner", &HexGamePyEngine::getWinner)
.def("getNodeValue", &HexGamePyEngine::getNodeValue)
.def("resetGame", &HexGamePyEngine::resetGame)
.def("setRedPlayerStrategy", &HexGamePyEngine::setRedPlayerStrategy)
.def("setBluePlayerStrategy", &HexGamePyEngine::setBluePlayerStrategy)
.add_property("numofhexgons", &HexGamePyEngine::getNumofhexgons,
&HexGamePyEngine::setNumofhexgons);
}
|
d4d5777346a94376e16c4c336fc632378fd804b9 | 0dc243cf9828bd1ca3acdefe02acf7febd7817fe | /src/Core_Include/Core_ByteArray.h | aceef30003d585e5be6b0e854bbaacec48250155 | [
"BSD-3-Clause"
] | permissive | Akranar/daguerreo | c8b38eb43cf4f59497c2d2d13ced92911bd3cc5a | 20999144d2c62e54837cd60462cf0db2cfb2d5c8 | refs/heads/master | 2020-05-22T12:38:22.550303 | 2011-10-05T22:55:26 | 2011-10-05T22:55:26 | 2,337,599 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 950 | h | Core_ByteArray.h | #ifndef PACKEDBYTES_H_
#define PACKEDBYTES_H_
template<int BYTE_COUNT>
class ByteArray
{
unsigned char data[BYTE_COUNT];
public:
ByteArray()
{
for (unsigned int i = 0; i < BYTE_COUNT; ++i)
{
data[i] = BYTE_COUNT;
}
};
virtual ~ByteArray() {};
static unsigned int ByteCount();
inline const unsigned char & operator[] (int index) const;
inline unsigned char & operator[] (int index);
inline void SetByte(int index, unsigned char value);
};
template<int BYTE_COUNT>
inline const unsigned char & ByteArray<BYTE_COUNT>::operator[] (int index) const
{
return data[index];
}
template<int BYTE_COUNT>
inline unsigned char & ByteArray<BYTE_COUNT>::operator[] (int index)
{
return data[index];
}
template<int BYTE_COUNT>
inline void ByteArray<BYTE_COUNT>::SetByte(int index, unsigned char value)
{
data[index] = value;
}
template<int BYTE_COUNT>
inline unsigned int ByteArray<BYTE_COUNT>::ByteCount()
{
return BYTE_COUNT;
}
#endif |
1522726d4cbacb25471c15bce9ab095167595978 | 3ac1f84f2d939de9e5836940d4f4ee28c8eaba80 | /Practice/4672.cpp | 4941de496e4a72f33099ecd6deb29252a5767d24 | [] | no_license | ensoo94/before2020 | e0d7cef190d13b31abbcebcf3142695c4f424eea | e5a5551915327e91589a9a8a4ea369933a5cb879 | refs/heads/master | 2023-01-24T13:05:22.690745 | 2020-12-05T07:42:22 | 2020-12-05T07:42:22 | 318,727,608 | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 564 | cpp | 4672.cpp | #include <iostream>
#include <vector>
#include <cstdio>
#include <string.h>
using namespace std;
int Answer;
int arr[26];
int main(int argc, char** argv)
{
int T, test_case;
cin >> T;
for(test_case = 0; test_case < T; test_case++)
{
Answer = 0;
string tmpStr;
cin>>tmpStr;
memset(arr, 0, sizeof(arr));
for (int i = 0; i < tmpStr.size(); i++) arr[tmpStr.at(i) - 97]++; //0 = aÀÇ ¼ö, 1 = bÀÇ ¼ö...
for (int j = 0; j < 26;j++) Answer += ((arr[j] * (arr[j] + 1)) / 2);
cout << "#" << test_case+1 <<" "<<Answer<<endl;
}
return 0;
}
|
36018931a80ea26b7acf0b5fd27322920e82ab75 | 2b1b459706bbac83dad951426927b5798e1786fc | /src/media/audio/audio_core/shared/loudness_transform.h | 711252327ef7ed3467c56495ac88df7f2657d92c | [
"BSD-2-Clause"
] | permissive | gnoliyil/fuchsia | bc205e4b77417acd4513fd35d7f83abd3f43eb8d | bc81409a0527580432923c30fbbb44aba677b57d | refs/heads/main | 2022-12-12T11:53:01.714113 | 2022-01-08T17:01:14 | 2022-12-08T01:29:53 | 445,866,010 | 4 | 3 | BSD-2-Clause | 2022-10-11T05:44:30 | 2022-01-08T16:09:33 | C++ | UTF-8 | C++ | false | false | 2,287 | h | loudness_transform.h | // Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SRC_MEDIA_AUDIO_AUDIO_CORE_SHARED_LOUDNESS_TRANSFORM_H_
#define SRC_MEDIA_AUDIO_AUDIO_CORE_SHARED_LOUDNESS_TRANSFORM_H_
#include <fuchsia/media/cpp/fidl.h>
#include <variant>
#include "src/media/audio/audio_core/shared/mixer/gain.h"
#include "src/media/audio/audio_core/shared/volume_curve.h"
#include "src/media/audio/lib/processing/gain.h"
namespace media::audio {
class MappedLoudnessTransform;
struct VolumeValue {
float value;
};
struct GainDbFsValue {
float value;
};
struct GainToVolumeValue {
float value;
};
// A loudness transform considers many stages of loudness that apply to a stream,
// including volume settings and gain adjustments, and applies them sequentially.
class LoudnessTransform {
public:
virtual ~LoudnessTransform() = default;
using Stage = std::variant<VolumeValue, GainDbFsValue, GainToVolumeValue>;
// Sequentially evaluates each loudness stage and returns the gain to use for
// the stream.
template <int N>
float Evaluate(std::array<Stage, N> stages) const {
float gain = media_audio::kUnityGainDb;
for (const auto& stage : stages) {
auto next_stage = EvaluateStageGain(stage);
gain = Gain::CombineGains(gain, next_stage);
}
return gain;
}
virtual float EvaluateStageGain(const Stage& stage) const = 0;
};
// Implements `LoudnessTransform` using a volume curve to map volume settings to
// gain in dbfs.
class MappedLoudnessTransform final : public LoudnessTransform {
public:
// The `volume_curve` must live as long as this transform.
explicit MappedLoudnessTransform(const VolumeCurve& volume_curve) : volume_curve_(volume_curve) {}
float EvaluateStageGain(const LoudnessTransform::Stage& stages) const override;
private:
const VolumeCurve volume_curve_;
};
// A `LoudnessTransform` that always returns unity gain, no matter what loudness stages are given.
class NoOpLoudnessTransform final : public LoudnessTransform {
float EvaluateStageGain(const LoudnessTransform::Stage& stages) const final;
};
} // namespace media::audio
#endif // SRC_MEDIA_AUDIO_AUDIO_CORE_SHARED_LOUDNESS_TRANSFORM_H_
|
23ae087215670c45950d697331dfbd5dc9ec896a | 42e4fb03c3ff4426e4c839f9d25ba703de52f42c | /ui_helpWindow.h | 05ec0a554cd8f9fa844f71004607318e05d169ea | [] | no_license | ArashMassoudieh/Aquifolium_GUI | 6c758d1dcfb3d3fc8e852ef05d67efb573866e53 | 994250e407bde7b08124d3576ae7f61e38359f31 | refs/heads/master | 2020-03-26T22:39:02.347783 | 2020-03-21T15:43:34 | 2020-03-21T15:43:34 | 145,476,765 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,335 | h | ui_helpWindow.h | /********************************************************************************
** Form generated from reading UI file 'helpWindow.ui'
**
** Created by: Qt User Interface Compiler version 5.11.1
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_HELPWINDOW_H
#define UI_HELPWINDOW_H
#include <QtCore/QVariant>
#include <QtWidgets/QApplication>
#include <QtWidgets/QDialog>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QSpacerItem>
#include <QtWidgets/QTextEdit>
#include <QtWidgets/QVBoxLayout>
QT_BEGIN_NAMESPACE
class Ui_helpWindow
{
public:
QVBoxLayout *verticalLayout;
QHBoxLayout *horizontalLayout;
QPushButton *back;
QPushButton *forward;
QSpacerItem *horizontalSpacer;
QSpacerItem *horizontalSpacer_3;
QSpacerItem *horizontalSpacer_2;
QPushButton *save;
QTextEdit *textEdit;
void setupUi(QDialog *helpWindow)
{
if (helpWindow->objectName().isEmpty())
helpWindow->setObjectName(QStringLiteral("helpWindow"));
helpWindow->resize(617, 163);
helpWindow->setLayoutDirection(Qt::LeftToRight);
helpWindow->setAutoFillBackground(false);
verticalLayout = new QVBoxLayout(helpWindow);
verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
horizontalLayout = new QHBoxLayout();
horizontalLayout->setObjectName(QStringLiteral("horizontalLayout"));
back = new QPushButton(helpWindow);
back->setObjectName(QStringLiteral("back"));
horizontalLayout->addWidget(back);
forward = new QPushButton(helpWindow);
forward->setObjectName(QStringLiteral("forward"));
horizontalLayout->addWidget(forward);
horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
horizontalLayout->addItem(horizontalSpacer);
horizontalSpacer_3 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
horizontalLayout->addItem(horizontalSpacer_3);
horizontalSpacer_2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
horizontalLayout->addItem(horizontalSpacer_2);
save = new QPushButton(helpWindow);
save->setObjectName(QStringLiteral("save"));
horizontalLayout->addWidget(save);
verticalLayout->addLayout(horizontalLayout);
textEdit = new QTextEdit(helpWindow);
textEdit->setObjectName(QStringLiteral("textEdit"));
textEdit->setEnabled(true);
verticalLayout->addWidget(textEdit);
retranslateUi(helpWindow);
QMetaObject::connectSlotsByName(helpWindow);
} // setupUi
void retranslateUi(QDialog *helpWindow)
{
helpWindow->setWindowTitle(QApplication::translate("helpWindow", "Help", nullptr));
back->setText(QApplication::translate("helpWindow", "<", nullptr));
forward->setText(QApplication::translate("helpWindow", ">", nullptr));
save->setText(QApplication::translate("helpWindow", "Save", nullptr));
} // retranslateUi
};
namespace Ui {
class helpWindow: public Ui_helpWindow {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_HELPWINDOW_H
|
7ce0139c2a1967efa506207c23e191b6e28709bf | 01e53bb0aad011745d6eab569690da305c59d69b | /Source/ServerListTool/ServersCheckerDlg.cpp | 85aa69fa216d753737aa125a0679c7d6202f2317 | [
"Apache-2.0"
] | permissive | zenden2k/image-uploader | 7905ac8d816943e29dfb71c0bb28f2e4644ffbb6 | 17ba538634b878b1828b5ee92d2e29feb20d6628 | refs/heads/master | 2023-08-04T17:43:26.934987 | 2023-07-25T16:10:50 | 2023-07-25T16:10:50 | 32,092,014 | 122 | 46 | Apache-2.0 | 2023-07-02T15:42:02 | 2015-03-12T17:43:48 | C++ | UTF-8 | C++ | false | false | 10,285 | cpp | ServersCheckerDlg.cpp | #include "ServersCheckerDlg.h"
#include "Gui/Dialogs/LogWindow.h"
#include "Core/Utils/CoreUtils.h"
#include "Gui/GuiTools.h"
#include "Func/WinUtils.h"
#include "Core/Utils/CryptoUtils.h"
#include "Core/Upload/UploadManager.h"
#include "ServersChecker.h"
#include "Core/ServiceLocator.h"
#include "Core/Settings/BasicSettings.h"
#include "Gui/Components/MyFileDialog.h"
#include "Core/Settings/WtlGuiSettings.h"
#include "Func/WebUtils.h"
namespace ServersListTool
{
CServersCheckerDlg::CServersCheckerDlg(WtlGuiSettings* settings, UploadEngineManager* uploadEngineManager, UploadManager* uploadManager, CMyEngineList* engineList,
std::shared_ptr<INetworkClientFactory> factory) :
model_(engineList), listView_(&model_), networkClientFactory_(std::move(factory)), settings_(settings)
{
uploadEngineManager_ = uploadEngineManager;
uploadManager_ = uploadManager;
engineList_ = engineList;
contextMenuItemId = -1;
}
LRESULT CServersCheckerDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
CenterWindow(); // center the dialog on the screen
DlgResize_Init(false, true, 0); // resizable dialog without "griper"
DoDataExchange(FALSE);
// set icons
icon_ = static_cast<HICON>(::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME),
IMAGE_ICON, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR));
SetIcon(icon_, TRUE);
iconSmall_ = static_cast<HICON>(::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME),
IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR));
SetIcon(iconSmall_, FALSE);
listView_.Init();
withAccountsRadioButton_.SetCheck(BST_CHECKED);
checkImageServersCheckBox_.SetCheck(BST_CHECKED);
listView_.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER, LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER);
SetDlgItemText(IDC_TOOLFILEEDIT, U2W(settings_->testFileName));
SetDlgItemText(IDC_TESTURLEDIT, U2W(settings_->testUrl));
serversChecker_ = std::make_unique<ServersChecker>(&model_, uploadManager_, networkClientFactory_);
serversChecker_->setOnFinishedCallback(std::bind(&CServersCheckerDlg::processFinished, this));
return TRUE;
}
LRESULT CServersCheckerDlg::OnContextMenu(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) {
HWND hwnd = reinterpret_cast<HWND>(wParam);
POINT ClientPoint, ScreenPoint;
if (hwnd != GetDlgItem(IDC_TOOLSERVERLIST)) return 0;
if (lParam == -1) {
ClientPoint.x = 0;
ClientPoint.y = 0;
int nCurItem = listView_.GetNextItem(-1, LVNI_ALL | LVNI_SELECTED);
if (nCurItem >= 0) {
CRect rc;
if (listView_.GetItemRect(nCurItem, &rc, LVIR_BOUNDS)) {
ClientPoint = rc.CenterPoint();
}
}
ScreenPoint = ClientPoint;
::ClientToScreen(hwnd, &ScreenPoint);
} else {
ScreenPoint.x = GET_X_LPARAM(lParam);
ScreenPoint.y = GET_Y_LPARAM(lParam);
ClientPoint = ScreenPoint;
::ScreenToClient(hwnd, &ClientPoint);
}
LV_HITTESTINFO hti;
memset(&hti, 0, sizeof(hti));
hti.pt = ClientPoint;
listView_.HitTest(&hti);
if (hti.iItem >= 0) {
ServerData* sd = model_.getDataByIndex(hti.iItem);
if (sd) {
CMenu menu;
menu.CreatePopupMenu();
menu.AppendMenu(MF_STRING, ID_COPYDIRECTURL, _T("Copy direct url"));
menu.EnableMenuItem(ID_COPYDIRECTURL, sd->directUrl().empty() ? MF_DISABLED : MF_ENABLED);
menu.AppendMenu(MF_STRING, ID_COPYTHUMBURL, _T("Copy thumb url"));
menu.EnableMenuItem(ID_COPYTHUMBURL, sd->thumbUrl().empty() ? MF_DISABLED : MF_ENABLED);
menu.AppendMenu(MF_STRING, ID_COPYVIEWURL, _T("Copy view url"));
menu.EnableMenuItem(ID_COPYVIEWURL, sd->viewurl().empty() ? MF_DISABLED : MF_ENABLED);
contextMenuItemId = hti.iItem;
menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON, ScreenPoint.x, ScreenPoint.y, m_hWnd);
}
}
return 0;
}
void CServersCheckerDlg::validateSettings() {
CString fileName = GuiTools::GetWindowText(GetDlgItem(IDC_TOOLFILEEDIT));
if (!WinUtils::FileExists(fileName)) {
throw ValidationException(CString(_T("Test file not found.")) + _T("\r\n") + fileName);
}
bool checkUrlShorteners = checkUrlShortenersCheckBox_.GetCheck() == BST_CHECKED;
CString url = GuiTools::GetWindowText(GetDlgItem(IDC_TESTURLEDIT));
if (checkUrlShorteners ){
if (url.IsEmpty()) {
throw ValidationException(_T("URL should not be empty!"));
}
if (!WebUtils::IsValidUrl(url)) {
throw ValidationException(_T("Invalid URL"));
}
}
}
LRESULT CServersCheckerDlg::OnOK(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
try {
validateSettings();
} catch (const ValidationException& ex) {
GuiTools::LocalizedMessageBox(m_hWnd, ex.errors_[0].Message, APPNAME, MB_ICONERROR);
return 0;
}
CString fileName = GuiTools::GetWindowText(GetDlgItem(IDC_TOOLFILEEDIT));
sourceFileHash_ = U2W(IuCoreUtils::CryptoUtils::CalcMD5HashFromFile(W2U(fileName)));
CString report = _T("Source file: ") + GetFileInfo(fileName, &sourceFileInfo_);
SetDlgItemText(IDC_TOOLSOURCEFILE, report);
::EnableWindow(GetDlgItem(IDOK), false);
::EnableWindow(GetDlgItem(IDCANCEL), false);
GuiTools::ShowDialogItem(m_hWnd, IDC_STOPBUTTON, true);
bool useAccounts = withAccountsRadioButton_.GetCheck() == BST_CHECKED || alwaysWithAccountsRadioButton_.GetCheck() == BST_CHECKED;
bool onlyAccs = alwaysWithAccountsRadioButton_.GetCheck() == BST_CHECKED;
bool checkImageServers = checkImageServersCheckBox_.GetCheck() == BST_CHECKED;
bool checkFileServers = checkFileServersCheckBox_.GetCheck() == BST_CHECKED;
bool checkUrlShorteners = checkUrlShortenersCheckBox_.GetCheck() == BST_CHECKED;
serversChecker_->setCheckFileServers(checkFileServers);
serversChecker_->setCheckImageServers(checkImageServers);
serversChecker_->setCheckUrlShorteners(checkUrlShorteners);
serversChecker_->setOnlyAccs(onlyAccs);
serversChecker_->setUseAccounts(useAccounts);
model_.resetData();
CString url = GuiTools::GetWindowText(GetDlgItem(IDC_TESTURLEDIT));
settings_->testFileName = W2U(fileName);
settings_->testUrl = W2U(url);
loadingAnimation_.ShowWindow(SW_SHOW);
serversChecker_->start(W2U(fileName), W2U(url));
return 0;
}
LRESULT CServersCheckerDlg::OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
if (isRunning()) {
stop();
} else {
EndDialog(wID);
}
return 0;
}
LRESULT CServersCheckerDlg::OnSkip(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
int nIndex = -1;
do {
nIndex = listView_.GetNextItem(nIndex, LVNI_SELECTED);
if (nIndex == -1) break;
ServerData* sd = model_.getDataByIndex(nIndex);
if (sd) {
sd->skip = !sd->skip;
model_.notifyRowChanged(nIndex);
}
} while (true);
return 0;
}
LRESULT CServersCheckerDlg::OnBrowseButton(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
IMyFileDialog::FileFilterArray filters = {
{_T("All files"), _T("*.*")}
};
auto dlg = MyFileDialogFactory::createFileDialog(m_hWnd, _T(""), _T(""), filters, false);
if (dlg->DoModal(m_hWnd) != IDOK) {
return 0;
}
SetDlgItemText(IDC_TOOLFILEEDIT, dlg->getFile());
return 0;
}
void CServersCheckerDlg::stop()
{
serversChecker_->stop();
}
bool CServersCheckerDlg::isRunning() const
{
return serversChecker_->isRunning();
}
void CServersCheckerDlg::processFinished() {
ServiceLocator::instance()->taskRunner()->runInGuiThread([this] {
::EnableWindow(GetDlgItem(IDOK), true);
::EnableWindow(GetDlgItem(IDCANCEL), true);
GuiTools::ShowDialogItem(m_hWnd, IDC_STOPBUTTON, false);
loadingAnimation_.ShowWindow(SW_HIDE);
});
}
LRESULT CServersCheckerDlg::OnErrorLogButtonClicked(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
CLogWindow* logWindow = ServiceLocator::instance()->logWindow();
logWindow->Show();
return 0;
}
LRESULT CServersCheckerDlg::OnSkipAll(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
for (int i = 0; i < engineList_->count(); i++) {
ServerData* sd = model_.getDataByIndex(i);
if (sd) {
sd->skip = !sd->skip;
}
}
listView_.Invalidate();
return 0;
}
LRESULT CServersCheckerDlg::OnCopyDirectUrl(WORD, WORD, HWND, BOOL&) {
ServerData* sd = model_.getDataByIndex(contextMenuItemId);
if (sd) {
std::string directUrl = sd->directUrl();
if (!directUrl.empty()) {
WinUtils::CopyTextToClipboard(U2W(directUrl));
}
}
return 0;
}
LRESULT CServersCheckerDlg::OnCopyThumbUrl(WORD, WORD, HWND, BOOL&) {
ServerData* sd = model_.getDataByIndex(contextMenuItemId);
if (sd) {
std::string thumbUrl = sd->thumbUrl();
if (!thumbUrl.empty()) {
WinUtils::CopyTextToClipboard(U2W(thumbUrl));
}
}
return 0;
}
LRESULT CServersCheckerDlg::OnCopyViewUrl(WORD, WORD, HWND, BOOL&) {
ServerData* sd = model_.getDataByIndex(contextMenuItemId);
if (sd) {
std::string viewUrl = sd->viewurl();
if (!viewUrl.empty()) {
WinUtils::CopyTextToClipboard(U2W(viewUrl));
}
}
return 0;
}
LRESULT CServersCheckerDlg::OnBnClickedStopbutton(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
serversChecker_->stop();
return 0;
}
}
|
f737b85e275aa854fd52966fe6433b1389cd4868 | c557ab896e575a31eac9bd939d8992a4c0d5553b | /main.cpp | 6fd1e815e9c108db75701d74418d63e87f26d5e7 | [] | no_license | popovicirobert/BFS | 030390ba2cff326e8f6f05d1f060e61b239913da | ef409b389569db4122dc4147ba4417527887de90 | refs/heads/master | 2023-01-21T01:50:37.579955 | 2020-11-30T19:57:51 | 2020-11-30T19:57:51 | 306,599,913 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,628 | cpp | main.cpp | #include <cstdio>
#include <cctype>
#define ull unsigned long long
#define MAXBUF (1 << 17)
static char buf[MAXBUF];
int pbuf;
static inline void Init() {
pbuf = MAXBUF;
}
static inline const char NextCh() {
if(pbuf == MAXBUF) {
fread(buf, 1, MAXBUF, stdin);
pbuf = 0;
}
return buf[pbuf++];
}
static inline const short GetNr() {
char ch = NextCh();
while(!isdigit(ch) && ch != ']') {
ch = NextCh();
}
if(isdigit(ch)) {
short ans = 0;
do {
ans = ans * 10 + ch - '0';
ch = NextCh();
} while(isdigit(ch));
return ans;
}
return -1;
}
#define MAXN 13000
#define MAXM 80000
static short x[MAXM], y[MAXM];
static int degree[MAXN];
static short edges[MAXM];
static char degree_rev[MAXN];
static short goodNodes[MAXN];
int size;
static char startPoint[MAXN];
inline int min(int a, int b) {
return a < b ? a : b;
}
inline int max(int a, int b) {
return a > b ? a : b;
}
int n, m;
static inline void ReadInput() {
while(1) {
m++;
x[m] = GetNr();
if(x[m] > -1) {
y[m] = GetNr();
}
else {
break;
}
}
m--;
for(int i = 0; i <= m; ++i) {
degree[x[i]]++;
degree_rev[y[i]] = 1;
}
n = MAXN - 1;
while(degree[n] == 0 && degree_rev[n] == 0) {
--n;
}
for(int i = 0; i <= n; ++i) {
if(degree[i] && degree_rev[i]) {
goodNodes[size++] = i;
}
}
for(int i = 1; i <= n + 1; ++i) {
degree[i] += degree[i - 1];
}
for(int i = 1; i <= m; ++i) {
degree[x[i]]--;
edges[degree[x[i]]] = y[i];
}
for(int i = 0; i <= n; i++) {
for(int j = degree[i]; j < degree[i + 1]; j++) {
const int nod = edges[j];
const int len = degree[nod + 1] - degree[nod];
if(len > 1 || (len == 1 && edges[degree[nod]] != i)) {
startPoint[i] = 1;
break;
}
}
}
}
static float g[MAXN];
#include <cstring>
#include <thread>
#include <mutex>
std::mutex mtx;
void Solve(int beg, int end) {
const int INF = 17; // merge aparent si cu 10
const float inv[32] = {0, 1, 0.5, 0.333333,
0.25, 0.2, 0.166667,
0.142857, 0.125, 0.111111,
0.1, 0.0909091, 0.0833333, 0.0769231,
0.0714286, 0.0666667, 0.0625, 0.0588235,
0.0555556, 0.0526316, 0.05, 0.047619,
0.0454545, 0.0434783, 0.0416667, 0.04,
0.0384615, 0.037037, 0.0357143, 0.0344828,
0.0333333, 0.0322581};
unsigned char dist[MAXN];
short ways0[MAXN];
float ways1[MAXN];
short Q[MAXN];
unsigned short last[MAXN];
unsigned short nxt[1 << 15];
short node[1 << 15];
float G[MAXN];
for(int s = beg; s <= end; ++s) {
if(!startPoint[s]) continue;
memset(dist, 0, sizeof(unsigned char) * (n + 1));
int l = 0, r = 1;
Q[0] = s;
dist[s] = ways0[s] = 1;
int sz = 1;
memset(last, 0, sizeof(unsigned short) * (n + 1));
while(l < r) {
const int nod = Q[l++];
if(ways0[nod] > INF) {
continue;
}
for(int i = degree[nod]; i < degree[nod + 1]; ++i) {
const int nei = edges[i];
const int dst = dist[nod] + 1;
if(!dist[nei]) {
Q[r++] = nei;
dist[nei] = dst;
ways0[nei] = ways0[nod];
nxt[sz] = last[nod];
node[sz] = nei;
last[nod] = sz++;
}
else if(dist[nei] == dst) {
ways0[nei] += ways0[nod];
nxt[sz] = last[nod];
node[sz] = nei;
last[nod] = sz++;
}
}
}
if(size < r) {
memset(G, 0, sizeof(float) * (n + 1));
}
for(int i = r - 1; i >= 1; --i) {
const int v = Q[i];
float sum = 0;
int pos = last[v];
while(pos) {
sum += ways1[node[pos]];
pos = nxt[pos];
}
G[v] = sum * ways0[v];
ways1[v] = sum + inv[ways0[v]];
}
mtx.lock();
{
if(size < r) {
for(int i = 0; i < size; ++i) {
const int nod = goodNodes[i];
g[nod] += G[nod];
}
}
else {
for(int i = 1; i < r; ++i) {
const int nod = Q[i];
g[nod] += G[nod];
}
}
}
mtx.unlock();
}
}
int main() {
Init();
ReadInput();
const int NUM_THREADS = 90;
int bucket = (n + 1) / NUM_THREADS;
std::thread t[NUM_THREADS];
int l = 0;
for(int i = 0; i < NUM_THREADS; i++) {
t[i] = std::thread(Solve, l, min(n, l + bucket));
l += bucket + 1;
}
for(int i = 0; i < NUM_THREADS; i++) {
t[i].join();
}
double mx = 0, mn = 1LL << 62;
for(int i = 0; i <= n; ++i) {
if(mx < g[i]) mx = g[i];
if(mn > g[i]) mn = g[i];
}
if(mx - mn > 0) {
printf("[");
for(int i = 0; i <= n; ++i) {
if(i) {
printf(",");
}
printf("(%d,%.2lf)", i, 1.0 * (g[i] - mn) / (mx - mn));
}
printf("]");
}
else {
printf("[");
for(int i = 0; i <= n; ++i) {
if(i) {
printf(",");
}
printf("(%d,0.00)", i);
}
printf("]");
}
return 0;
}
|
1f5fdcd32a3dec9a0850cb19f8ede7e698ac668f | 76171660651f1c680d5b5a380c07635de5b2367c | /SH6_58mps/0.099925/T | ac792e3ec840bb8fde2dc0b0758aa8a73132ba87 | [] | no_license | lisegaAM/SH_Paper1 | 3cd0cac0d95cc60d296268e65e2dd6fed4cc6127 | 12ceadba5c58c563ccac236b965b4b917ac47551 | refs/heads/master | 2021-04-27T19:44:19.527187 | 2018-02-21T16:16:50 | 2018-02-21T16:16:50 | 122,360,661 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 109,428 | T | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 3.0.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0.099925";
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField nonuniform List<scalar>
13800
(
773.08
773.08
773.081
773.083
773.083
773.082
773.079
773.076
773.075
773.074
773.074
773.074
773.074
773.074
773.074
773.074
773.074
773.075
773.075
773.075
773.076
773.077
773.078
773.08
773.081
773.083
773.085
773.088
773.09
773.093
773.096
773.099
773.102
773.105
773.108
773.112
773.115
773.118
773.121
773.123
773.126
773.128
773.129
773.131
773.131
773.132
773.132
773.131
773.13
773.128
773.126
773.124
773.121
773.118
773.115
773.111
773.107
773.103
773.099
773.094
773.09
773.086
773.082
773.078
773.074
773.07
773.066
773.063
773.06
773.057
773.054
773.052
773.05
773.048
773.046
773.044
773.043
773.041
773.04
773.039
773.039
773.038
773.037
773.037
773.037
773.036
773.036
773.036
773.036
773.036
773.037
773.037
773.038
773.038
773.039
773.04
773.042
773.043
773.045
773.047
773.05
773.052
773.056
773.059
773.063
773.067
773.071
773.076
773.08
773.085
773.091
773.096
773.101
773.106
773.111
773.115
773.119
773.123
773.126
773.128
773.13
773.131
773.132
773.131
773.13
773.129
773.127
773.124
773.121
773.117
773.113
773.109
773.105
773.101
773.097
773.093
773.09
773.086
773.083
773.081
773.078
773.076
773.074
773.073
773.072
773.071
773.07
773.07
773.069
773.069
773.069
773.069
773.069
773.069
773.069
773.069
773.069
773.069
773.069
773.069
773.069
773.069
773.068
773.068
773.068
773.068
773.068
773.069
773.069
773.069
773.069
773.07
773.07
773.071
773.072
773.073
773.074
773.075
773.077
773.079
773.082
773.084
773.087
773.091
773.095
773.099
773.103
773.108
773.112
773.117
773.123
773.128
773.133
773.138
773.143
773.148
773.151
773.163
773.169
773.372
773.077
773.077
773.078
773.08
773.081
773.079
773.076
773.074
773.072
773.072
773.072
773.072
773.072
773.072
773.072
773.072
773.072
773.072
773.073
773.074
773.074
773.075
773.076
773.078
773.079
773.081
773.083
773.086
773.088
773.091
773.094
773.097
773.1
773.103
773.107
773.11
773.113
773.116
773.119
773.121
773.124
773.126
773.127
773.129
773.13
773.13
773.13
773.129
773.128
773.127
773.125
773.122
773.119
773.116
773.113
773.109
773.105
773.101
773.097
773.092
773.088
773.084
773.08
773.076
773.072
773.068
773.064
773.061
773.058
773.055
773.052
773.05
773.048
773.046
773.044
773.042
773.041
773.04
773.038
773.037
773.037
773.036
773.035
773.035
773.035
773.034
773.034
773.034
773.034
773.034
773.035
773.035
773.036
773.037
773.037
773.039
773.04
773.041
773.043
773.045
773.048
773.051
773.054
773.057
773.061
773.065
773.069
773.074
773.079
773.084
773.089
773.094
773.099
773.104
773.109
773.113
773.117
773.121
773.124
773.126
773.128
773.129
773.13
773.129
773.129
773.127
773.125
773.122
773.119
773.115
773.111
773.107
773.103
773.099
773.095
773.091
773.088
773.084
773.081
773.079
773.076
773.074
773.072
773.071
773.07
773.069
773.068
773.068
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.068
773.068
773.069
773.07
773.071
773.072
773.074
773.075
773.077
773.08
773.082
773.086
773.089
773.093
773.097
773.101
773.106
773.111
773.116
773.121
773.126
773.131
773.136
773.141
773.146
773.149
773.162
773.166
773.398
773.077
773.077
773.078
773.08
773.081
773.08
773.076
773.074
773.073
773.072
773.072
773.072
773.072
773.072
773.072
773.072
773.072
773.072
773.073
773.074
773.074
773.075
773.076
773.078
773.079
773.081
773.083
773.086
773.088
773.091
773.094
773.097
773.1
773.103
773.107
773.11
773.113
773.116
773.119
773.121
773.124
773.126
773.127
773.129
773.13
773.13
773.13
773.129
773.128
773.127
773.125
773.122
773.119
773.116
773.113
773.109
773.105
773.101
773.097
773.092
773.088
773.084
773.08
773.076
773.072
773.068
773.064
773.061
773.058
773.055
773.052
773.05
773.048
773.046
773.044
773.042
773.041
773.04
773.038
773.037
773.037
773.036
773.035
773.035
773.035
773.034
773.034
773.034
773.034
773.034
773.035
773.035
773.036
773.037
773.037
773.039
773.04
773.041
773.043
773.045
773.048
773.051
773.054
773.057
773.061
773.065
773.069
773.074
773.079
773.084
773.089
773.094
773.099
773.104
773.109
773.113
773.117
773.121
773.124
773.126
773.128
773.129
773.13
773.129
773.129
773.127
773.125
773.122
773.119
773.115
773.111
773.107
773.103
773.099
773.095
773.091
773.088
773.084
773.081
773.079
773.076
773.074
773.072
773.071
773.07
773.069
773.068
773.068
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.068
773.068
773.069
773.07
773.071
773.072
773.074
773.075
773.077
773.08
773.082
773.086
773.089
773.093
773.097
773.101
773.106
773.111
773.116
773.121
773.126
773.131
773.136
773.141
773.146
773.149
773.162
773.166
773.391
773.077
773.077
773.078
773.08
773.081
773.08
773.076
773.074
773.073
773.072
773.072
773.072
773.072
773.072
773.072
773.072
773.072
773.072
773.073
773.074
773.074
773.075
773.076
773.078
773.079
773.081
773.083
773.086
773.088
773.091
773.094
773.097
773.1
773.103
773.107
773.11
773.113
773.116
773.119
773.121
773.124
773.126
773.127
773.129
773.13
773.13
773.13
773.129
773.128
773.127
773.125
773.122
773.119
773.116
773.113
773.109
773.105
773.101
773.097
773.092
773.088
773.084
773.08
773.076
773.072
773.068
773.064
773.061
773.058
773.055
773.052
773.05
773.048
773.046
773.044
773.042
773.041
773.04
773.038
773.037
773.037
773.036
773.035
773.035
773.035
773.034
773.034
773.034
773.034
773.034
773.035
773.035
773.036
773.037
773.037
773.039
773.04
773.041
773.043
773.045
773.048
773.051
773.054
773.057
773.061
773.065
773.069
773.074
773.079
773.084
773.089
773.094
773.099
773.104
773.109
773.113
773.117
773.121
773.124
773.126
773.128
773.129
773.13
773.129
773.129
773.127
773.125
773.122
773.119
773.115
773.111
773.107
773.103
773.099
773.095
773.091
773.088
773.084
773.081
773.079
773.076
773.074
773.072
773.071
773.07
773.069
773.068
773.068
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.068
773.068
773.069
773.07
773.071
773.072
773.074
773.075
773.077
773.08
773.082
773.086
773.089
773.093
773.097
773.101
773.106
773.111
773.116
773.121
773.126
773.131
773.136
773.141
773.146
773.149
773.16
773.165
773.334
773.077
773.077
773.078
773.08
773.081
773.08
773.076
773.074
773.073
773.072
773.072
773.072
773.072
773.072
773.072
773.072
773.072
773.072
773.073
773.074
773.074
773.075
773.076
773.078
773.079
773.081
773.083
773.086
773.088
773.091
773.094
773.097
773.1
773.103
773.107
773.11
773.113
773.116
773.119
773.121
773.124
773.126
773.127
773.129
773.13
773.13
773.13
773.129
773.128
773.127
773.125
773.122
773.119
773.116
773.113
773.109
773.105
773.101
773.097
773.092
773.088
773.084
773.08
773.076
773.072
773.068
773.064
773.061
773.058
773.055
773.052
773.05
773.048
773.046
773.044
773.042
773.041
773.04
773.038
773.037
773.037
773.036
773.035
773.035
773.035
773.034
773.034
773.034
773.034
773.034
773.035
773.035
773.036
773.037
773.037
773.039
773.04
773.041
773.043
773.045
773.048
773.051
773.054
773.057
773.061
773.065
773.069
773.074
773.079
773.084
773.089
773.094
773.099
773.104
773.109
773.113
773.117
773.121
773.124
773.126
773.128
773.129
773.13
773.129
773.129
773.127
773.125
773.122
773.119
773.115
773.111
773.107
773.103
773.099
773.095
773.091
773.088
773.084
773.081
773.079
773.076
773.074
773.072
773.071
773.07
773.069
773.068
773.068
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.068
773.068
773.069
773.07
773.071
773.072
773.074
773.075
773.077
773.08
773.082
773.086
773.089
773.093
773.097
773.101
773.106
773.111
773.116
773.121
773.126
773.131
773.136
773.141
773.146
773.149
773.158
773.158
773.269
773.077
773.077
773.078
773.08
773.081
773.08
773.076
773.074
773.073
773.072
773.072
773.072
773.072
773.072
773.072
773.072
773.072
773.072
773.073
773.074
773.074
773.075
773.076
773.078
773.079
773.081
773.083
773.086
773.088
773.091
773.094
773.097
773.1
773.103
773.107
773.11
773.113
773.116
773.119
773.121
773.124
773.126
773.127
773.129
773.13
773.13
773.13
773.129
773.128
773.127
773.125
773.122
773.119
773.116
773.113
773.109
773.105
773.101
773.097
773.092
773.088
773.084
773.08
773.076
773.072
773.068
773.064
773.061
773.058
773.055
773.052
773.05
773.048
773.046
773.044
773.042
773.041
773.04
773.038
773.037
773.037
773.036
773.035
773.035
773.035
773.034
773.034
773.034
773.034
773.034
773.035
773.035
773.036
773.037
773.037
773.039
773.04
773.041
773.043
773.045
773.048
773.051
773.054
773.057
773.061
773.065
773.069
773.074
773.079
773.084
773.089
773.094
773.099
773.104
773.109
773.113
773.117
773.121
773.124
773.126
773.128
773.129
773.13
773.129
773.129
773.127
773.125
773.122
773.119
773.115
773.111
773.107
773.103
773.099
773.095
773.091
773.088
773.084
773.081
773.079
773.076
773.074
773.072
773.071
773.07
773.069
773.068
773.068
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.068
773.068
773.069
773.07
773.071
773.072
773.074
773.075
773.077
773.08
773.082
773.086
773.089
773.093
773.097
773.101
773.106
773.111
773.116
773.121
773.126
773.131
773.136
773.141
773.145
773.149
773.153
773.15
773.122
773.077
773.077
773.078
773.08
773.081
773.08
773.076
773.074
773.073
773.072
773.072
773.072
773.072
773.072
773.072
773.072
773.072
773.072
773.073
773.074
773.074
773.075
773.076
773.078
773.079
773.081
773.083
773.086
773.088
773.091
773.094
773.097
773.1
773.103
773.107
773.11
773.113
773.116
773.119
773.121
773.124
773.126
773.127
773.129
773.13
773.13
773.13
773.129
773.128
773.127
773.125
773.122
773.119
773.116
773.113
773.109
773.105
773.101
773.097
773.092
773.088
773.084
773.08
773.076
773.072
773.068
773.064
773.061
773.058
773.055
773.052
773.05
773.048
773.046
773.044
773.042
773.041
773.04
773.038
773.037
773.037
773.036
773.035
773.035
773.035
773.034
773.034
773.034
773.034
773.034
773.035
773.035
773.036
773.037
773.037
773.039
773.04
773.041
773.043
773.045
773.048
773.051
773.054
773.057
773.061
773.065
773.069
773.074
773.079
773.084
773.089
773.094
773.099
773.104
773.109
773.113
773.117
773.121
773.124
773.126
773.128
773.129
773.13
773.129
773.129
773.127
773.125
773.122
773.119
773.115
773.111
773.107
773.103
773.099
773.095
773.091
773.088
773.084
773.081
773.079
773.076
773.074
773.072
773.071
773.07
773.069
773.068
773.068
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.068
773.068
773.069
773.07
773.071
773.072
773.074
773.075
773.077
773.08
773.082
773.086
773.089
773.093
773.097
773.101
773.106
773.111
773.116
773.121
773.126
773.131
773.136
773.141
773.144
773.15
773.145
773.142
772.93
773.077
773.077
773.078
773.08
773.081
773.08
773.076
773.074
773.073
773.072
773.072
773.072
773.072
773.072
773.072
773.072
773.072
773.072
773.073
773.074
773.074
773.075
773.076
773.078
773.079
773.081
773.083
773.086
773.088
773.091
773.094
773.097
773.1
773.103
773.107
773.11
773.113
773.116
773.119
773.121
773.124
773.126
773.127
773.129
773.13
773.13
773.13
773.129
773.128
773.127
773.125
773.122
773.119
773.116
773.113
773.109
773.105
773.101
773.097
773.092
773.088
773.084
773.08
773.076
773.072
773.068
773.064
773.061
773.058
773.055
773.052
773.05
773.048
773.046
773.044
773.042
773.041
773.04
773.038
773.037
773.037
773.036
773.035
773.035
773.035
773.034
773.034
773.034
773.034
773.034
773.035
773.035
773.036
773.037
773.037
773.039
773.04
773.041
773.043
773.045
773.048
773.051
773.054
773.057
773.061
773.065
773.069
773.074
773.079
773.084
773.089
773.094
773.099
773.104
773.109
773.113
773.117
773.121
773.124
773.126
773.128
773.129
773.13
773.129
773.129
773.127
773.125
773.122
773.119
773.115
773.111
773.107
773.103
773.099
773.095
773.091
773.088
773.084
773.081
773.079
773.076
773.074
773.072
773.071
773.07
773.069
773.068
773.068
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.068
773.068
773.069
773.07
773.071
773.072
773.074
773.075
773.077
773.08
773.082
773.086
773.089
773.093
773.097
773.101
773.106
773.111
773.116
773.121
773.126
773.131
773.136
773.141
773.144
773.15
773.14
773.161
772.652
773.077
773.077
773.078
773.08
773.081
773.079
773.076
773.074
773.072
773.072
773.072
773.072
773.072
773.072
773.072
773.072
773.072
773.072
773.073
773.074
773.074
773.075
773.076
773.078
773.079
773.081
773.083
773.086
773.088
773.091
773.094
773.097
773.1
773.103
773.107
773.11
773.113
773.116
773.119
773.121
773.124
773.126
773.127
773.129
773.13
773.13
773.13
773.129
773.128
773.127
773.125
773.122
773.119
773.116
773.113
773.109
773.105
773.101
773.097
773.092
773.088
773.084
773.08
773.076
773.072
773.068
773.064
773.061
773.058
773.055
773.052
773.05
773.048
773.046
773.044
773.042
773.041
773.04
773.038
773.037
773.037
773.036
773.035
773.035
773.035
773.034
773.034
773.034
773.034
773.034
773.035
773.035
773.036
773.037
773.037
773.039
773.04
773.041
773.043
773.045
773.048
773.051
773.054
773.057
773.061
773.065
773.069
773.074
773.079
773.084
773.089
773.094
773.099
773.104
773.109
773.113
773.117
773.121
773.124
773.126
773.128
773.129
773.13
773.129
773.129
773.127
773.125
773.122
773.119
773.115
773.111
773.107
773.103
773.099
773.095
773.091
773.088
773.084
773.081
773.079
773.076
773.074
773.072
773.071
773.07
773.069
773.068
773.068
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.067
773.068
773.068
773.069
773.07
773.071
773.072
773.074
773.075
773.077
773.08
773.082
773.086
773.089
773.093
773.097
773.101
773.106
773.111
773.116
773.121
773.126
773.131
773.136
773.141
773.144
773.151
773.138
773.175
772.513
773.08
773.08
773.081
773.083
773.083
773.082
773.079
773.076
773.075
773.074
773.074
773.074
773.074
773.074
773.074
773.074
773.074
773.075
773.075
773.075
773.076
773.077
773.078
773.08
773.081
773.083
773.085
773.088
773.09
773.093
773.096
773.099
773.102
773.105
773.108
773.112
773.115
773.118
773.121
773.123
773.126
773.128
773.129
773.131
773.131
773.132
773.132
773.131
773.13
773.128
773.126
773.124
773.121
773.118
773.115
773.111
773.107
773.103
773.099
773.094
773.09
773.086
773.082
773.078
773.074
773.07
773.066
773.063
773.06
773.057
773.054
773.052
773.05
773.048
773.046
773.044
773.043
773.041
773.04
773.039
773.039
773.038
773.037
773.037
773.037
773.036
773.036
773.036
773.036
773.036
773.037
773.037
773.038
773.038
773.039
773.04
773.042
773.043
773.045
773.047
773.05
773.052
773.056
773.059
773.063
773.067
773.071
773.076
773.08
773.085
773.091
773.096
773.101
773.106
773.111
773.115
773.119
773.123
773.126
773.128
773.13
773.131
773.132
773.131
773.13
773.129
773.127
773.124
773.121
773.117
773.113
773.109
773.105
773.101
773.097
773.093
773.09
773.086
773.083
773.081
773.078
773.076
773.074
773.073
773.072
773.071
773.07
773.07
773.069
773.069
773.069
773.069
773.069
773.069
773.069
773.069
773.069
773.069
773.069
773.069
773.069
773.069
773.068
773.068
773.068
773.068
773.068
773.069
773.069
773.069
773.069
773.07
773.07
773.071
773.072
773.073
773.074
773.075
773.077
773.079
773.082
773.084
773.087
773.091
773.095
773.099
773.103
773.108
773.112
773.117
773.123
773.128
773.133
773.138
773.143
773.146
773.153
773.139
773.191
772.387
773.339
773.375
773.399
773.406
773.41
773.413
773.416
773.417
773.418
773.419
773.419
773.42
773.418
773.416
773.412
773.406
773.397
773.382
773.36
773.315
773.336
773.36
773.374
773.377
773.378
773.379
773.379
773.379
773.378
773.377
773.376
773.375
773.374
773.37
773.367
773.359
773.351
773.335
773.313
773.273
773.333
773.36
773.377
773.381
773.383
773.385
773.386
773.387
773.387
773.386
773.385
773.383
773.381
773.377
773.371
773.361
773.349
773.331
773.305
773.267
773.289
773.302
773.308
773.308
773.309
773.311
773.313
773.315
773.317
773.32
773.323
773.327
773.331
773.335
773.337
773.338
773.333
773.325
773.307
773.281
773.238
773.256
773.27
773.28
773.286
773.29
773.29
773.287
773.284
773.277
773.269
773.256
773.246
773.232
773.218
773.202
773.188
773.174
773.162
773.152
773.136
773.128
773.114
773.103
773.095
773.091
773.091
773.094
773.099
773.107
773.118
773.133
773.148
773.165
773.183
773.201
773.221
773.235
773.252
773.257
773.016
773.006
773.006
773.009
773.01
773.005
773.001
772.991
772.981
772.964
772.949
772.929
772.912
772.891
772.876
772.861
772.858
772.862
772.879
772.894
772.853
772.807
772.766
772.743
772.73
772.724
772.721
772.722
772.729
772.741
772.759
772.78
772.806
772.836
772.867
772.899
772.944
772.978
773.036
773.084
772.745
772.7
772.654
772.624
772.603
772.583
772.569
772.556
772.549
772.541
772.541
772.543
772.551
772.565
772.583
772.603
772.63
772.671
772.725
772.797
772.683
772.619
772.544
772.517
772.496
772.493
772.501
772.51
772.526
772.548
772.571
772.607
772.637
772.682
772.721
772.766
772.816
772.875
772.949
773.032
773.19
773.148
773.134
773.13
773.127
773.122
773.117
773.114
773.111
773.109
773.106
773.102
773.094
773.081
773.069
773.058
773.054
773.057
773.09
773.281
774.112
776.115
777.857
778.868
779.212
779.18
778.567
776.448
774.226
772.813
772.1
771.865
771.861
772.018
772.388
772.66
772.828
772.924
772.977
773.006
773.021
773.029
773.034
773.037
773.039
773.04
773.041
773.042
773.042
773.042
773.042
773.042
773.042
773.042
773.042
773.042
773.041
773.041
773.041
773.041
773.041
773.041
773.041
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.039
773.039
773.039
773.039
773.039
773.039
773.039
773.039
773.039
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.039
773.039
773.039
773.04
773.04
773.041
773.041
773.042
773.043
773.044
773.045
773.046
773.047
773.049
773.051
773.053
773.055
773.057
773.06
773.062
773.065
773.069
773.072
773.075
773.079
773.083
773.087
773.091
773.095
773.1
773.104
773.108
773.112
773.116
773.12
773.123
773.126
773.128
773.111
773.138
772.479
773.162
773.124
773.11
773.106
773.102
773.099
773.096
773.092
773.088
773.082
773.079
773.076
773.074
773.07
773.064
773.049
773.01
772.971
772.942
772.92
772.91
772.913
772.95
773.103
773.355
773.569
773.709
773.77
773.777
773.745
773.598
773.375
773.212
773.112
773.06
773.033
773.021
773.019
773.02
773.023
773.027
773.031
773.034
773.036
773.038
773.039
773.039
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.039
773.039
773.039
773.039
773.039
773.039
773.039
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.037
773.037
773.037
773.037
773.038
773.038
773.039
773.039
773.04
773.041
773.042
773.043
773.044
773.045
773.047
773.049
773.051
773.053
773.055
773.058
773.06
773.063
773.067
773.07
773.074
773.077
773.081
773.085
773.089
773.094
773.098
773.102
773.106
773.11
773.114
773.118
773.121
773.124
773.126
773.11
773.127
772.57
773.164
773.128
773.116
773.111
773.108
773.103
773.099
773.096
773.094
773.092
773.089
773.085
773.078
773.07
773.064
773.059
773.055
773.05
773.037
772.991
772.841
772.651
772.518
772.451
772.438
772.455
772.572
772.904
773.2
773.36
773.415
773.417
773.379
773.261
773.158
773.094
773.058
773.038
773.031
773.029
773.03
773.032
773.035
773.037
773.038
773.039
773.039
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.039
773.039
773.039
773.039
773.039
773.039
773.039
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.037
773.037
773.037
773.037
773.038
773.038
773.039
773.039
773.04
773.041
773.042
773.043
773.044
773.045
773.047
773.049
773.051
773.053
773.055
773.058
773.06
773.063
773.067
773.07
773.074
773.077
773.081
773.085
773.089
773.094
773.098
773.102
773.106
773.11
773.114
773.118
773.121
773.124
773.126
773.112
773.116
772.698
773.209
773.182
773.179
773.177
773.174
773.17
773.167
773.164
773.161
773.158
773.155
773.15
773.144
773.136
773.128
773.122
773.117
773.113
773.104
773.079
772.993
772.85
772.741
772.679
772.661
772.668
772.723
772.882
773.023
773.102
773.136
773.142
773.135
773.103
773.071
773.051
773.04
773.035
773.034
773.034
773.035
773.037
773.038
773.039
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.039
773.039
773.039
773.039
773.039
773.039
773.039
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.037
773.037
773.037
773.037
773.038
773.038
773.039
773.039
773.04
773.041
773.042
773.043
773.044
773.045
773.047
773.049
773.051
773.053
773.055
773.058
773.06
773.063
773.067
773.07
773.074
773.077
773.081
773.085
773.089
773.094
773.098
773.102
773.106
773.11
773.114
773.118
773.121
773.125
773.126
773.12
773.11
772.94
773.124
773.114
773.104
773.095
773.09
773.086
773.082
773.078
773.074
773.072
773.069
773.068
773.067
773.066
773.063
773.061
773.06
773.062
773.065
773.066
773.066
773.059
773.025
772.969
772.929
772.911
772.91
772.918
772.952
772.99
773.012
773.023
773.028
773.03
773.031
773.031
773.033
773.034
773.036
773.037
773.038
773.039
773.039
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.039
773.039
773.039
773.039
773.039
773.039
773.039
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.037
773.037
773.037
773.037
773.038
773.038
773.039
773.039
773.04
773.041
773.042
773.043
773.044
773.045
773.047
773.049
773.051
773.053
773.055
773.058
773.06
773.063
773.067
773.07
773.074
773.077
773.081
773.085
773.089
773.094
773.098
773.102
773.106
773.11
773.114
773.118
773.121
773.124
773.127
773.128
773.123
773.101
773.277
773.289
773.297
773.302
773.303
773.301
773.3
773.298
773.293
773.288
773.282
773.277
773.271
773.264
773.255
773.246
773.238
773.231
773.225
773.219
773.209
773.18
773.113
773.045
772.994
772.96
772.943
772.941
772.944
772.961
772.988
773.009
773.024
773.034
773.04
773.044
773.046
773.047
773.046
773.045
773.044
773.044
773.043
773.042
773.042
773.041
773.041
773.041
773.041
773.041
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.039
773.039
773.039
773.039
773.039
773.039
773.039
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.037
773.037
773.037
773.037
773.038
773.038
773.039
773.039
773.04
773.041
773.042
773.043
773.044
773.045
773.047
773.049
773.051
773.053
773.055
773.058
773.06
773.063
773.067
773.07
773.074
773.077
773.081
773.085
773.089
773.094
773.098
773.102
773.106
773.11
773.114
773.118
773.121
773.125
773.127
773.134
773.137
773.227
772.976
772.997
772.996
772.994
772.989
772.984
772.981
772.979
772.976
772.973
772.972
772.97
772.968
772.968
772.97
772.975
772.976
772.977
772.978
772.984
773.007
773.03
773.039
773.04
773.028
772.974
772.906
772.868
772.857
772.86
772.884
772.936
772.977
773.008
773.027
773.038
773.044
773.047
773.047
773.047
773.046
773.045
773.044
773.043
773.042
773.042
773.041
773.041
773.041
773.041
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.039
773.039
773.039
773.039
773.039
773.039
773.039
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.037
773.037
773.037
773.037
773.038
773.038
773.039
773.039
773.04
773.041
773.042
773.043
773.044
773.045
773.047
773.049
773.051
773.053
773.055
773.058
773.06
773.063
773.067
773.07
773.074
773.077
773.081
773.085
773.089
773.094
773.098
773.102
773.106
773.11
773.114
773.118
773.121
773.125
773.128
773.137
773.148
773.283
773.255
773.292
773.301
773.301
773.299
773.295
773.291
773.287
773.283
773.279
773.277
773.277
773.277
773.276
773.271
773.269
773.272
773.291
773.316
773.328
773.33
773.326
773.297
773.201
773.083
772.998
772.945
772.92
772.916
772.921
772.945
772.984
773.014
773.033
773.045
773.051
773.054
773.054
773.054
773.051
773.049
773.047
773.045
773.044
773.043
773.042
773.042
773.041
773.041
773.041
773.041
773.04
773.04
773.04
773.04
773.04
773.04
773.039
773.039
773.039
773.039
773.039
773.039
773.039
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.037
773.037
773.037
773.037
773.038
773.038
773.039
773.039
773.04
773.041
773.042
773.043
773.044
773.045
773.047
773.049
773.051
773.053
773.055
773.058
773.06
773.063
773.067
773.07
773.074
773.077
773.081
773.085
773.089
773.094
773.098
773.102
773.106
773.11
773.114
773.118
773.121
773.125
773.128
773.139
773.15
773.336
773.046
773.103
773.117
773.119
773.118
773.115
773.111
773.108
773.106
773.106
773.107
773.107
773.104
773.104
773.107
773.118
773.124
773.126
773.129
773.14
773.194
773.305
773.369
773.389
773.388
773.364
773.292
773.215
773.159
773.124
773.103
773.092
773.084
773.079
773.074
773.069
773.065
773.06
773.056
773.053
773.05
773.047
773.046
773.044
773.043
773.042
773.042
773.041
773.041
773.041
773.041
773.04
773.04
773.04
773.04
773.04
773.04
773.039
773.039
773.039
773.039
773.039
773.039
773.039
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.037
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.036
773.037
773.037
773.037
773.037
773.038
773.038
773.039
773.039
773.04
773.041
773.042
773.043
773.044
773.045
773.047
773.049
773.051
773.053
773.055
773.058
773.06
773.063
773.067
773.07
773.074
773.077
773.081
773.085
773.089
773.094
773.098
773.102
773.106
773.11
773.114
773.118
773.121
773.125
773.128
773.139
773.151
773.342
773.291
773.329
773.336
773.336
773.334
773.331
773.327
773.323
773.32
773.32
773.32
773.318
773.311
773.283
773.202
773.131
773.103
773.105
773.157
773.422
773.991
774.458
774.76
774.907
774.948
774.939
774.841
774.513
774.135
773.829
773.594
773.421
773.298
773.214
773.157
773.119
773.094
773.078
773.067
773.059
773.054
773.051
773.048
773.047
773.045
773.044
773.044
773.043
773.043
773.043
773.042
773.042
773.042
773.042
773.042
773.042
773.042
773.041
773.041
773.041
773.041
773.041
773.041
773.04
773.04
773.04
773.04
773.04
773.04
773.04
773.039
773.039
773.039
773.039
773.039
773.039
773.039
773.039
773.039
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.038
773.039
773.039
773.039
773.04
773.04
773.041
773.041
773.042
773.043
773.044
773.045
773.046
773.047
773.049
773.051
773.053
773.055
773.057
773.06
773.062
773.065
773.069
773.072
773.075
773.079
773.083
773.087
773.091
773.095
773.1
773.104
773.108
773.112
773.116
773.12
773.123
773.127
773.13
773.14
773.154
773.316
772.694
772.625
772.549
772.516
772.495
772.488
772.494
772.503
772.517
772.539
772.561
772.597
772.627
772.673
772.711
772.756
772.806
772.865
772.941
773.023
772.739
772.694
772.646
772.613
772.59
772.569
772.555
772.54
772.533
772.525
772.524
772.526
772.535
772.548
772.566
772.587
772.614
772.656
772.711
772.784
772.841
772.797
772.754
772.728
772.715
772.707
772.703
772.704
772.71
772.722
772.739
772.76
772.785
772.816
772.845
772.885
772.913
772.969
773.013
773.065
772.994
772.983
772.98
772.983
772.983
772.978
772.974
772.964
772.954
772.937
772.922
772.902
772.884
772.864
772.849
772.834
772.831
772.835
772.853
772.868
773.108
773.099
773.085
773.073
773.065
773.06
773.06
773.062
773.067
773.075
773.086
773.1
773.115
773.132
773.15
773.168
773.188
773.202
773.219
773.224
773.209
773.226
773.24
773.251
773.259
773.263
773.264
773.261
773.258
773.251
773.243
773.23
773.22
773.205
773.192
773.175
773.161
773.147
773.135
773.125
773.263
773.275
773.282
773.283
773.285
773.287
773.289
773.291
773.293
773.296
773.299
773.303
773.307
773.31
773.312
773.313
773.309
773.299
773.282
773.256
773.312
773.335
773.353
773.359
773.361
773.364
773.366
773.366
773.366
773.365
773.364
773.362
773.359
773.355
773.349
773.34
773.328
773.311
773.286
773.247
773.314
773.336
773.352
773.355
773.358
773.359
773.359
773.359
773.358
773.357
773.356
773.354
773.353
773.35
773.346
773.339
773.331
773.316
773.295
773.254
773.313
773.35
773.376
773.384
773.39
773.393
773.395
773.397
773.398
773.399
773.399
773.398
773.398
773.396
773.392
773.387
773.377
773.363
773.34
773.296
773.278
773.315
773.323
773.326
773.325
773.322
773.318
773.313
773.309
773.307
773.304
773.302
773.296
773.279
773.217
773.128
773.077
773.066
773.082
773.203
773.648
774.22
774.636
774.881
774.985
775.004
774.977
774.807
774.411
774.047
773.756
773.535
773.372
773.257
773.178
773.125
773.089
773.066
773.051
773.041
773.033
773.028
773.025
773.023
773.021
773.019
773.019
773.018
773.017
773.017
773.017
773.016
773.016
773.016
773.016
773.016
773.015
773.015
773.015
773.015
773.015
773.015
773.015
773.014
773.014
773.014
773.014
773.014
773.014
773.014
773.014
773.014
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.012
773.012
773.012
773.012
773.012
773.012
773.011
773.01
772.99
773.013
772.367
773.03
773.087
773.1
773.102
773.101
773.1
773.098
773.094
773.091
773.09
773.089
773.088
773.086
773.083
773.083
773.089
773.099
773.102
773.102
773.103
773.112
773.159
773.256
773.309
773.324
773.322
773.295
773.223
773.155
773.109
773.081
773.066
773.058
773.053
773.049
773.045
773.042
773.038
773.034
773.03
773.027
773.024
773.022
773.02
773.018
773.017
773.016
773.016
773.015
773.015
773.015
773.015
773.014
773.014
773.014
773.014
773.014
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.012
773.012
773.012
773.012
773.012
773.012
773.012
773.012
773.012
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.01
773.01
773.01
773.01
773.01
773.01
773.009
773.008
772.99
773.002
772.453
773.234
773.269
773.279
773.281
773.28
773.278
773.274
773.27
773.265
773.26
773.256
773.254
773.253
773.252
773.25
773.244
773.242
773.245
773.261
773.275
773.282
773.282
773.275
773.236
773.129
773.021
772.947
772.901
772.883
772.881
772.889
772.92
772.958
772.988
773.007
773.018
773.025
773.028
773.028
773.027
773.025
773.023
773.021
773.019
773.018
773.017
773.016
773.016
773.015
773.015
773.015
773.015
773.014
773.014
773.014
773.014
773.014
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.012
773.012
773.012
773.012
773.012
773.012
773.012
773.012
773.012
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.01
773.01
773.01
773.01
773.01
773.01
773.009
773.008
772.991
772.992
772.581
772.948
772.968
772.97
772.968
772.964
772.96
772.956
772.953
772.949
772.947
772.945
772.943
772.94
772.938
772.938
772.94
772.944
772.946
772.946
772.948
772.955
772.977
772.993
772.999
772.998
772.98
772.919
772.858
772.827
772.821
772.826
772.857
772.911
772.952
772.982
773.001
773.011
773.018
773.021
773.021
773.021
773.02
773.019
773.018
773.017
773.016
773.016
773.015
773.015
773.015
773.015
773.014
773.014
773.014
773.014
773.014
773.014
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.012
773.012
773.012
773.012
773.012
773.012
773.012
773.012
773.012
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.01
773.01
773.01
773.01
773.01
773.01
773.01
773.008
773.001
772.989
772.82
773.243
773.254
773.264
773.27
773.27
773.269
773.266
773.264
773.26
773.255
773.249
773.243
773.237
773.231
773.224
773.216
773.208
773.2
773.194
773.188
773.181
773.163
773.116
773.048
772.988
772.946
772.917
772.906
772.906
772.912
772.935
772.963
772.984
772.998
773.008
773.014
773.018
773.02
773.02
773.02
773.019
773.019
773.018
773.017
773.016
773.016
773.016
773.015
773.015
773.015
773.015
773.014
773.014
773.014
773.014
773.014
773.014
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.012
773.012
773.012
773.012
773.012
773.012
773.012
773.012
773.012
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.01
773.01
773.01
773.01
773.01
773.01
773.01
773.009
773.007
773.001
772.979
773.097
773.086
773.076
773.066
773.06
773.056
773.052
773.048
773.044
773.041
773.039
773.036
773.035
773.034
773.032
773.029
773.028
773.029
773.032
773.033
773.034
773.031
773.016
772.965
772.909
772.874
772.862
772.863
772.879
772.925
772.965
772.988
772.999
773.004
773.005
773.005
773.006
773.007
773.008
773.01
773.011
773.012
773.013
773.014
773.014
773.014
773.014
773.015
773.015
773.014
773.014
773.014
773.014
773.014
773.014
773.014
773.014
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.012
773.012
773.012
773.012
773.012
773.012
773.012
773.012
773.012
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.01
773.01
773.01
773.01
773.01
773.01
773.01
773.011
773.014
773.017
773.102
773.187
773.156
773.151
773.148
773.145
773.142
773.14
773.138
773.135
773.131
773.127
773.123
773.118
773.111
773.105
773.099
773.093
773.089
773.084
773.071
773.029
772.9
772.744
772.634
772.578
772.566
772.579
772.66
772.845
772.99
773.07
773.105
773.112
773.105
773.075
773.043
773.024
773.013
773.008
773.007
773.008
773.009
773.011
773.012
773.013
773.014
773.014
773.014
773.014
773.014
773.014
773.014
773.014
773.014
773.014
773.014
773.014
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.012
773.012
773.012
773.012
773.012
773.012
773.012
773.012
773.012
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.01
773.01
773.01
773.01
773.01
773.01
773.011
773.012
773.018
773.029
773.157
773.146
773.105
773.091
773.086
773.084
773.079
773.075
773.072
773.07
773.068
773.065
773.061
773.056
773.049
773.044
773.04
773.036
773.033
773.025
773.003
772.916
772.685
772.462
772.316
772.25
772.242
772.272
772.446
772.846
773.163
773.336
773.396
773.399
773.362
773.244
773.137
773.071
773.034
773.013
773.005
773.003
773.004
773.006
773.009
773.011
773.012
773.013
773.013
773.014
773.014
773.014
773.014
773.014
773.014
773.014
773.014
773.014
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.012
773.012
773.012
773.012
773.012
773.012
773.012
773.012
773.012
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.01
773.01
773.01
773.01
773.01
773.01
773.011
773.013
773.02
773.032
773.21
773.144
773.101
773.087
773.083
773.08
773.077
773.075
773.072
773.067
773.062
773.057
773.055
773.053
773.05
773.046
773.039
773.023
772.986
772.947
772.911
772.878
772.857
772.856
772.882
773.007
773.272
773.508
773.664
773.734
773.746
773.721
773.592
773.368
773.199
773.094
773.038
773.009
772.996
772.993
772.993
772.996
773.001
773.005
773.008
773.01
773.012
773.013
773.013
773.014
773.014
773.014
773.014
773.014
773.014
773.014
773.014
773.014
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.012
773.012
773.012
773.012
773.012
773.012
773.012
773.012
773.012
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.011
773.01
773.01
773.01
773.01
773.01
773.01
773.011
773.013
773.02
773.032
773.216
773.172
773.126
773.112
773.108
773.105
773.101
773.097
773.093
773.091
773.089
773.085
773.079
773.071
773.063
773.055
773.049
773.045
773.047
773.063
773.158
773.601
775.162
777.353
778.921
779.725
779.928
779.798
778.802
776.231
774.026
772.645
771.963
771.75
771.754
771.937
772.329
772.613
772.789
772.89
772.947
772.977
772.993
773.002
773.008
773.011
773.013
773.014
773.015
773.016
773.016
773.016
773.016
773.016
773.016
773.016
773.016
773.015
773.015
773.015
773.015
773.015
773.015
773.015
773.014
773.014
773.014
773.014
773.014
773.014
773.014
773.014
773.014
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.013
773.012
773.012
773.012
773.012
773.012
773.012
773.013
773.015
773.021
773.035
773.19
772.571
772.501
772.425
772.39
772.369
772.362
772.368
772.377
772.391
772.414
772.435
772.472
772.501
772.547
772.586
772.632
772.682
772.742
772.818
772.901
772.614
772.569
772.521
772.487
772.464
772.442
772.428
772.413
772.406
772.397
772.397
772.398
772.407
772.42
772.438
772.46
772.487
772.529
772.585
772.658
772.717
772.673
772.628
772.602
772.588
772.58
772.576
772.577
772.583
772.594
772.611
772.632
772.657
772.688
772.718
772.758
772.786
772.843
772.888
772.94
772.869
772.858
772.854
772.856
772.857
772.851
772.847
772.837
772.827
772.81
772.794
772.774
772.756
772.736
772.721
772.706
772.703
772.707
772.725
772.74
772.984
772.974
772.959
772.947
772.939
772.934
772.933
772.935
772.94
772.947
772.958
772.97
772.988
773.004
773.022
773.039
773.059
773.073
773.09
773.095
773.083
773.099
773.115
773.125
773.133
773.137
773.138
773.135
773.132
773.125
773.117
773.106
773.093
773.079
773.065
773.049
773.035
773.022
773.01
773.001
773.138
773.149
773.157
773.158
773.159
773.162
773.163
773.165
773.167
773.17
773.173
773.177
773.181
773.185
773.188
773.189
773.185
773.177
773.159
773.134
773.187
773.21
773.228
773.235
773.237
773.239
773.24
773.241
773.241
773.24
773.24
773.238
773.237
773.233
773.228
773.219
773.207
773.188
773.162
773.123
773.189
773.211
773.228
773.231
773.233
773.234
773.234
773.233
773.233
773.232
773.232
773.231
773.231
773.228
773.225
773.218
773.209
773.193
773.171
773.13
773.188
773.225
773.252
773.26
773.265
773.268
773.27
773.272
773.273
773.274
773.275
773.275
773.275
773.274
773.27
773.264
773.254
773.24
773.216
773.172
773.161
773.194
773.202
773.204
773.204
773.204
773.204
773.204
773.206
773.209
773.211
773.211
773.205
773.174
773.084
773.015
772.993
772.998
773.062
773.362
773.962
774.444
774.749
774.895
774.934
774.922
774.806
774.447
774.055
773.742
773.501
773.324
773.198
773.111
773.052
773.012
772.985
772.966
772.953
772.944
772.936
772.93
772.925
772.921
772.917
772.914
772.911
772.908
772.906
772.904
772.902
772.9
772.899
772.898
772.897
772.897
772.897
772.897
772.897
772.898
772.899
772.901
772.902
772.904
772.906
772.908
772.911
772.914
772.916
772.919
772.922
772.925
772.928
772.931
772.934
772.938
772.941
772.944
772.946
772.949
772.952
772.954
772.957
772.959
772.961
772.963
772.965
772.967
772.969
772.97
772.972
772.973
772.974
772.975
772.976
772.977
772.978
772.979
772.979
772.98
772.98
772.981
772.981
772.982
772.982
772.982
772.982
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.983
772.984
772.991
773.004
773.165
772.912
772.966
772.98
772.984
772.984
772.984
772.985
772.985
772.986
772.989
772.992
772.993
772.995
772.998
773.005
773.017
773.024
773.027
773.029
773.035
773.069
773.167
773.241
773.266
773.267
773.249
773.182
773.106
773.052
773.019
773
772.989
772.981
772.975
772.969
772.962
772.956
772.949
772.943
772.937
772.931
772.927
772.922
772.918
772.915
772.912
772.909
772.906
772.904
772.902
772.9
772.898
772.897
772.896
772.895
772.895
772.895
772.895
772.896
772.896
772.897
772.899
772.9
772.902
772.904
772.907
772.909
772.912
772.914
772.917
772.92
772.923
772.926
772.93
772.933
772.936
772.939
772.942
772.944
772.947
772.95
772.952
772.955
772.957
772.959
772.961
772.963
772.965
772.967
772.969
772.97
772.971
772.972
772.973
772.974
772.975
772.976
772.977
772.977
772.978
772.979
772.979
772.979
772.98
772.98
772.98
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.981
772.981
772.981
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.981
772.982
772.99
773.001
773.191
773.114
773.148
773.158
773.16
773.16
773.16
773.16
773.16
773.159
773.158
773.159
773.163
773.166
773.168
773.167
773.166
773.168
773.18
773.193
773.201
773.203
773.199
773.17
773.073
772.962
772.883
772.835
772.814
772.81
772.816
772.844
772.884
772.913
772.931
772.941
772.945
772.945
772.944
772.94
772.935
772.93
772.926
772.922
772.918
772.915
772.911
772.909
772.906
772.904
772.902
772.9
772.898
772.897
772.896
772.895
772.895
772.895
772.895
772.896
772.896
772.897
772.899
772.9
772.902
772.904
772.907
772.909
772.912
772.914
772.917
772.92
772.923
772.926
772.93
772.933
772.936
772.939
772.942
772.944
772.947
772.95
772.952
772.955
772.957
772.959
772.961
772.963
772.965
772.967
772.969
772.97
772.971
772.972
772.973
772.974
772.975
772.976
772.977
772.977
772.978
772.979
772.979
772.979
772.98
772.98
772.98
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.981
772.981
772.981
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.981
772.982
772.99
773.001
773.184
772.823
772.849
772.848
772.846
772.844
772.844
772.845
772.846
772.846
772.845
772.846
772.847
772.849
772.851
772.857
772.863
772.867
772.87
772.873
772.88
772.901
772.921
772.929
772.929
772.916
772.861
772.796
772.76
772.751
772.754
772.781
772.835
772.876
772.905
772.923
772.932
772.935
772.936
772.934
772.931
772.928
772.924
772.92
772.917
772.914
772.911
772.908
772.906
772.904
772.902
772.9
772.898
772.897
772.896
772.895
772.895
772.895
772.895
772.896
772.896
772.897
772.899
772.9
772.902
772.904
772.907
772.909
772.912
772.914
772.917
772.92
772.923
772.926
772.93
772.933
772.936
772.939
772.942
772.944
772.947
772.95
772.952
772.955
772.957
772.959
772.961
772.963
772.965
772.967
772.969
772.97
772.971
772.972
772.973
772.974
772.975
772.976
772.977
772.977
772.978
772.979
772.979
772.979
772.98
772.98
772.98
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.981
772.98
772.981
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.981
772.982
772.988
772.999
773.131
773.117
773.132
773.14
773.147
773.152
773.153
773.153
773.154
773.154
773.153
773.151
773.148
773.146
773.142
773.137
773.131
773.125
773.121
773.118
773.113
773.101
773.066
772.998
772.934
772.886
772.854
772.839
772.838
772.841
772.86
772.888
772.909
772.924
772.932
772.937
772.938
772.938
772.936
772.933
772.93
772.926
772.923
772.92
772.917
772.914
772.911
772.908
772.906
772.904
772.902
772.9
772.898
772.897
772.896
772.895
772.895
772.895
772.895
772.896
772.896
772.897
772.899
772.9
772.902
772.904
772.907
772.909
772.912
772.914
772.917
772.92
772.923
772.926
772.93
772.933
772.936
772.939
772.942
772.944
772.947
772.95
772.952
772.955
772.957
772.959
772.961
772.963
772.965
772.967
772.969
772.97
772.971
772.972
772.973
772.974
772.975
772.976
772.977
772.977
772.978
772.979
772.979
772.979
772.98
772.98
772.98
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.981
772.98
772.981
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.981
772.984
772.987
773.074
772.973
772.963
772.954
772.948
772.944
772.942
772.941
772.941
772.94
772.941
772.941
772.942
772.944
772.946
772.947
772.948
772.95
772.955
772.96
772.962
772.962
772.954
772.915
772.854
772.814
772.798
772.797
772.808
772.848
772.888
772.912
772.923
772.927
772.928
772.927
772.926
772.925
772.924
772.923
772.922
772.92
772.918
772.916
772.914
772.912
772.91
772.907
772.905
772.903
772.901
772.9
772.898
772.897
772.896
772.895
772.895
772.895
772.895
772.896
772.896
772.897
772.899
772.9
772.902
772.904
772.907
772.909
772.912
772.914
772.917
772.92
772.923
772.926
772.93
772.933
772.936
772.939
772.942
772.944
772.947
772.95
772.952
772.955
772.957
772.959
772.961
772.963
772.965
772.967
772.969
772.97
772.971
772.972
772.973
772.974
772.975
772.976
772.977
772.977
772.978
772.979
772.979
772.979
772.98
772.98
772.98
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.981
772.981
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.979
772.978
772.972
772.949
773.06
773.036
773.029
773.029
773.029
773.03
773.031
773.03
773.03
773.029
773.029
773.028
773.025
773.021
773.018
773.016
773.015
773.012
773.005
772.978
772.875
772.714
772.593
772.528
772.51
772.518
772.585
772.76
772.912
772.998
773.032
773.039
773.031
772.999
772.965
772.944
772.932
772.924
772.92
772.918
772.917
772.916
772.915
772.913
772.911
772.909
772.907
772.905
772.903
772.901
772.9
772.898
772.897
772.896
772.895
772.895
772.895
772.895
772.896
772.896
772.897
772.899
772.9
772.902
772.904
772.907
772.909
772.912
772.914
772.917
772.92
772.923
772.926
772.93
772.933
772.936
772.939
772.942
772.944
772.947
772.95
772.952
772.955
772.957
772.959
772.961
772.963
772.965
772.967
772.969
772.97
772.971
772.972
772.973
772.974
772.975
772.976
772.977
772.977
772.978
772.979
772.979
772.979
772.98
772.98
772.98
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.981
772.981
772.981
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.978
772.971
772.96
772.785
773.018
772.983
772.973
772.969
772.967
772.966
772.966
772.966
772.966
772.967
772.966
772.965
772.962
772.96
772.959
772.959
772.958
772.956
772.943
772.885
772.69
772.45
772.285
772.207
772.193
772.215
772.365
772.754
773.084
773.264
773.326
773.329
773.29
773.17
773.06
772.99
772.951
772.93
772.919
772.914
772.912
772.912
772.912
772.911
772.91
772.908
772.907
772.905
772.903
772.901
772.9
772.898
772.897
772.896
772.895
772.895
772.895
772.895
772.895
772.896
772.897
772.899
772.9
772.902
772.904
772.907
772.909
772.912
772.914
772.917
772.92
772.923
772.926
772.93
772.933
772.936
772.939
772.942
772.944
772.947
772.95
772.952
772.955
772.957
772.959
772.961
772.963
772.965
772.967
772.969
772.97
772.971
772.972
772.973
772.974
772.975
772.976
772.977
772.977
772.978
772.979
772.979
772.979
772.98
772.98
772.98
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.981
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.979
772.978
772.962
772.965
772.54
773.017
772.98
772.97
772.965
772.964
772.964
772.964
772.964
772.962
772.96
772.96
772.96
772.961
772.962
772.961
772.954
772.929
772.891
772.854
772.818
772.795
772.79
772.805
772.896
773.142
773.389
773.557
773.635
773.649
773.624
773.492
773.268
773.102
773.001
772.948
772.923
772.911
772.907
772.906
772.907
772.909
772.911
772.911
772.911
772.909
772.908
772.906
772.905
772.903
772.901
772.9
772.898
772.897
772.896
772.895
772.895
772.895
772.895
772.895
772.896
772.897
772.899
772.9
772.902
772.904
772.907
772.909
772.912
772.914
772.917
772.92
772.923
772.926
772.93
772.933
772.936
772.939
772.942
772.944
772.947
772.95
772.952
772.955
772.957
772.959
772.961
772.963
772.965
772.967
772.969
772.97
772.971
772.972
772.973
772.974
772.975
772.976
772.977
772.977
772.978
772.979
772.979
772.979
772.98
772.98
772.98
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.981
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.981
772.98
772.981
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.98
772.979
772.978
772.96
772.975
772.411
773.046
773.005
772.995
772.99
772.988
772.987
772.987
772.988
772.988
772.988
772.986
772.983
772.978
772.973
772.968
772.968
772.969
772.98
773.041
773.341
774.534
776.752
778.467
779.413
779.699
779.626
778.839
776.441
774.156
772.717
771.994
771.757
771.753
771.914
772.285
772.556
772.721
772.814
772.865
772.891
772.903
772.909
772.911
772.912
772.911
772.91
772.908
772.906
772.905
772.903
772.901
772.9
772.899
772.898
772.897
772.897
772.897
772.897
772.897
772.898
772.899
772.901
772.902
772.904
772.906
772.908
772.911
772.914
772.916
772.919
772.922
772.925
772.928
772.931
772.934
772.938
772.941
772.944
772.946
772.949
772.952
772.954
772.957
772.959
772.961
772.963
772.965
772.967
772.969
772.97
772.972
772.973
772.974
772.975
772.976
772.977
772.978
772.979
772.979
772.98
772.98
772.981
772.981
772.982
772.982
772.982
772.982
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.984
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.983
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.982
772.981
772.98
772.961
772.987
772.319
773.159
773.196
773.223
773.231
773.236
773.239
773.241
773.242
773.243
773.245
773.246
773.246
773.246
773.244
773.242
773.236
773.228
773.214
773.192
773.149
773.159
773.181
773.198
773.202
773.204
773.204
773.204
773.204
773.203
773.202
773.203
773.201
773.201
773.198
773.196
773.19
773.182
773.167
773.146
773.106
773.158
773.181
773.199
773.206
773.208
773.21
773.211
773.211
773.211
773.211
773.21
773.209
773.207
773.204
773.199
773.191
773.179
773.162
773.138
773.099
773.109
773.12
773.128
773.129
773.131
773.132
773.134
773.135
773.137
773.14
773.144
773.148
773.152
773.156
773.159
773.161
773.157
773.15
773.133
773.109
773.054
773.07
773.086
773.096
773.103
773.108
773.109
773.106
773.103
773.096
773.088
773.077
773.064
773.05
773.037
773.021
773.007
772.993
772.982
772.973
772.954
772.944
772.93
772.918
772.909
772.904
772.904
772.906
772.91
772.918
772.928
772.941
772.958
772.974
772.993
773.01
773.03
773.045
773.063
773.07
772.838
772.827
772.823
772.826
772.826
772.821
772.817
772.806
772.796
772.779
772.764
772.743
772.726
772.705
772.689
772.674
772.669
772.672
772.688
772.702
772.684
772.64
772.595
772.569
772.555
772.547
772.543
772.543
772.55
772.561
772.577
772.598
772.623
772.653
772.683
772.722
772.75
772.806
772.845
772.899
772.581
772.535
772.487
772.453
772.43
772.408
772.394
772.379
772.371
772.363
772.362
772.363
772.37
772.383
772.401
772.422
772.446
772.487
772.537
772.606
772.535
772.465
772.389
772.355
772.334
772.326
772.333
772.342
772.355
772.378
772.401
772.435
772.466
772.509
772.55
772.593
772.643
772.7
772.771
772.851
773.001
772.967
772.958
772.956
772.956
772.958
772.958
772.956
772.95
772.942
772.937
772.936
772.942
772.991
773.278
774.521
776.604
777.95
778.467
778.474
777.911
775.873
773.889
772.764
772.286
772.179
772.22
772.428
772.639
772.759
772.823
772.854
772.868
772.875
772.877
772.876
772.875
772.874
772.872
772.87
772.869
772.868
772.867
772.867
772.867
772.868
772.869
772.871
772.873
772.875
772.878
772.881
772.884
772.888
772.892
772.896
772.9
772.904
772.908
772.911
772.915
772.919
772.922
772.925
772.928
772.931
772.934
772.936
772.938
772.94
772.942
772.944
772.945
772.946
772.947
772.948
772.949
772.949
772.95
772.95
772.951
772.951
772.951
772.951
772.951
772.952
772.952
772.952
772.951
772.951
772.951
772.951
772.951
772.95
772.95
772.949
772.949
772.948
772.947
772.946
772.944
772.943
772.941
772.939
772.937
772.934
772.931
772.928
772.925
772.922
772.919
772.916
772.912
772.909
772.906
772.903
772.9
772.898
772.896
772.894
772.893
772.892
772.891
772.891
772.892
772.893
772.894
772.896
772.899
772.901
772.904
772.908
772.911
772.915
772.919
772.923
772.927
772.931
772.934
772.938
772.942
772.945
772.949
772.952
772.955
772.957
772.96
772.962
772.964
772.966
772.968
772.969
772.971
772.972
772.973
772.974
772.974
772.975
772.976
772.976
772.976
772.977
772.977
772.977
772.977
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.977
772.977
772.977
772.977
772.977
772.977
772.977
772.977
772.977
772.977
772.977
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.975
772.975
772.975
772.975
772.974
772.973
772.973
772.972
772.97
772.969
772.967
772.966
772.964
772.961
772.959
772.956
772.953
772.95
772.947
772.943
772.94
772.937
772.933
772.93
772.927
772.924
772.922
772.919
772.918
772.916
772.915
772.915
772.915
772.915
772.916
772.918
772.92
772.922
772.925
772.928
772.931
772.935
772.938
772.942
772.946
772.95
772.954
772.958
772.962
772.965
772.969
772.972
772.975
772.978
772.981
772.983
772.986
772.988
772.989
772.991
772.993
772.994
772.995
772.996
772.997
772.998
772.998
772.999
773
773
773
773.001
773.001
773.001
773.001
773.001
773.001
773.002
773.002
773.002
773.002
773.002
773.002
773.002
773.002
773.002
773.002
773.002
773.002
773.002
773.002
773.002
773.002
773.002
773.002
773.002
773.003
773.003
773.003
773.003
773.003
773.004
773.004
773.004
773.005
773.005
773.006
773.006
773.007
773.008
773.009
773.01
773.011
773.012
773.014
773.016
773.017
773.019
773.021
773.023
773.026
773.029
773.031
773.034
773.038
773.041
773.045
773.048
773.053
773.057
773.061
773.066
773.071
773.076
773.082
773.087
773.093
773.099
773.106
773.112
773.119
773.126
773.133
773.141
773.149
773.157
773.165
773.173
773.182
773.191
773.2
773.21
773.219
773.229
773.24
773.25
773.261
773.272
773.283
773.294
773.306
773.318
773.33
773.342
773.355
773.368
773.381
773.394
773.408
773.422
773.436
773.45
773.465
773.48
773.495
773.51
773.526
773.541
773.558
773.574
773.591
773.607
773.624
773.642
773.659
773.677
773.695
773.714
773.732
773.751
773.77
773.789
773.809
773.829
773.849
773.869
773.89
773.91
773.931
773.953
773.974
773.996
774.018
774.04
774.063
774.086
774.109
774.132
774.155
774.179
774.203
774.227
774.251
774.276
774.301
774.326
774.351
774.377
774.403
774.429
774.455
774.482
774.508
774.535
774.563
774.59
774.618
774.645
774.674
774.702
774.73
774.759
774.788
774.817
774.847
774.876
774.906
774.936
774.967
774.997
775.028
775.059
775.09
775.121
775.153
775.185
775.216
775.249
775.281
775.314
775.346
775.379
775.412
775.446
775.479
775.513
775.547
775.581
775.615
775.65
775.684
775.719
775.754
775.789
775.825
775.86
775.896
775.932
775.968
776.004
776.041
776.077
776.114
776.151
776.188
776.225
776.263
776.3
776.338
776.376
776.414
776.452
776.49
776.529
776.567
776.606
776.645
776.684
776.723
776.763
776.802
776.842
776.881
776.921
776.961
777.001
777.041
777.082
777.122
777.163
777.203
777.244
777.285
777.326
777.367
777.408
777.45
777.491
777.533
777.574
777.616
777.658
777.7
777.742
777.784
777.826
777.868
777.911
777.953
777.996
778.038
778.081
778.124
778.166
778.209
778.252
778.295
778.338
778.381
778.424
778.468
778.511
778.555
778.597
778.642
778.684
778.729
778.771
778.816
778.858
778.904
778.946
778.991
779.033
779.079
779.121
779.167
779.208
779.256
772.974
772.942
772.935
772.934
772.934
772.933
772.93
772.93
772.931
772.931
772.931
772.925
772.899
772.85
772.807
772.786
772.787
772.831
773.027
773.304
773.472
773.53
773.525
773.436
773.214
773.045
772.949
772.904
772.884
772.876
772.873
772.873
772.875
772.876
772.876
772.875
772.874
772.872
772.87
772.869
772.867
772.866
772.865
772.865
772.865
772.866
772.867
772.869
772.871
772.873
772.876
772.879
772.883
772.886
772.89
772.894
772.898
772.902
772.906
772.909
772.913
772.917
772.92
772.923
772.926
772.929
772.932
772.934
772.936
772.938
772.94
772.942
772.943
772.944
772.945
772.946
772.947
772.947
772.948
772.948
772.949
772.949
772.949
772.949
772.95
772.95
772.95
772.95
772.95
772.949
772.949
772.949
772.949
772.948
772.948
772.947
772.947
772.946
772.945
772.944
772.942
772.941
772.939
772.937
772.935
772.932
772.929
772.927
772.924
772.92
772.917
772.914
772.911
772.907
772.904
772.901
772.899
772.896
772.894
772.892
772.891
772.89
772.889
772.889
772.89
772.891
772.892
772.894
772.897
772.899
772.902
772.906
772.909
772.913
772.917
772.921
772.925
772.929
772.933
772.936
772.94
772.943
772.947
772.95
772.953
772.955
772.958
772.96
772.962
772.964
772.966
772.967
772.969
772.97
772.971
772.972
772.972
772.973
772.974
772.974
772.974
772.975
772.975
772.975
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.973
772.973
772.973
772.972
772.971
772.971
772.97
772.968
772.967
772.966
772.964
772.962
772.959
772.957
772.954
772.951
772.948
772.945
772.942
772.938
772.935
772.931
772.928
772.925
772.922
772.92
772.918
772.916
772.914
772.913
772.913
772.913
772.913
772.914
772.916
772.918
772.92
772.923
772.926
772.929
772.933
772.936
772.94
772.944
772.948
772.952
772.956
772.96
772.963
772.967
772.97
772.973
772.976
772.979
772.981
772.984
772.986
772.988
772.989
772.991
772.992
772.993
772.994
772.995
772.996
772.997
772.997
772.998
772.998
772.998
772.999
772.999
772.999
772.999
772.999
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773.001
773.001
773.001
773.001
773.001
773.001
773.002
773.002
773.002
773.003
773.003
773.004
773.005
773.005
773.006
773.007
773.008
773.009
773.011
773.012
773.014
773.015
773.017
773.019
773.022
773.024
773.027
773.029
773.032
773.036
773.039
773.043
773.047
773.051
773.055
773.059
773.064
773.069
773.074
773.08
773.085
773.091
773.097
773.104
773.11
773.117
773.124
773.131
773.139
773.147
773.155
773.163
773.171
773.18
773.189
773.198
773.208
773.217
773.227
773.238
773.248
773.259
773.27
773.281
773.292
773.304
773.316
773.328
773.34
773.353
773.366
773.379
773.392
773.406
773.42
773.434
773.448
773.463
773.478
773.493
773.508
773.524
773.54
773.556
773.572
773.589
773.605
773.623
773.64
773.657
773.675
773.693
773.712
773.73
773.749
773.768
773.788
773.807
773.827
773.847
773.867
773.888
773.909
773.93
773.951
773.972
773.994
774.016
774.038
774.061
774.084
774.107
774.13
774.153
774.177
774.201
774.225
774.25
774.274
774.299
774.324
774.35
774.375
774.401
774.427
774.453
774.48
774.507
774.533
774.561
774.588
774.616
774.644
774.672
774.7
774.729
774.757
774.786
774.816
774.845
774.875
774.904
774.935
774.965
774.995
775.026
775.057
775.088
775.119
775.151
775.183
775.215
775.247
775.279
775.312
775.344
775.377
775.411
775.444
775.477
775.511
775.545
775.579
775.613
775.648
775.683
775.717
775.753
775.788
775.823
775.859
775.894
775.93
775.966
776.003
776.039
776.076
776.112
776.149
776.186
776.224
776.261
776.299
776.336
776.374
776.412
776.45
776.489
776.527
776.566
776.605
776.643
776.682
776.722
776.761
776.8
776.84
776.88
776.919
776.959
777
777.04
777.08
777.12
777.161
777.202
777.243
777.283
777.324
777.366
777.407
777.448
777.49
777.531
777.573
777.614
777.656
777.698
777.74
777.782
777.824
777.867
777.909
777.952
777.994
778.037
778.079
778.122
778.165
778.208
778.251
778.294
778.337
778.38
778.423
778.466
778.509
778.553
778.596
778.64
778.683
778.727
778.77
778.815
778.857
778.902
778.944
778.99
779.032
779.078
779.119
779.165
779.207
779.255
772.979
772.947
772.939
772.938
772.939
772.94
772.939
772.936
772.933
772.932
772.934
772.935
772.934
772.925
772.865
772.661
772.446
772.333
772.308
772.33
772.491
772.849
773.091
773.189
773.204
773.181
773.087
772.992
772.935
772.905
772.89
772.882
772.879
772.878
772.877
772.876
772.874
772.872
772.87
772.869
772.867
772.866
772.865
772.865
772.865
772.866
772.867
772.869
772.871
772.873
772.876
772.879
772.883
772.886
772.89
772.894
772.898
772.902
772.906
772.909
772.913
772.917
772.92
772.923
772.926
772.929
772.932
772.934
772.936
772.938
772.94
772.942
772.943
772.944
772.945
772.946
772.947
772.947
772.948
772.948
772.949
772.949
772.949
772.949
772.95
772.95
772.95
772.95
772.95
772.949
772.949
772.949
772.949
772.948
772.948
772.947
772.947
772.946
772.945
772.944
772.942
772.941
772.939
772.937
772.935
772.932
772.929
772.927
772.924
772.92
772.917
772.914
772.911
772.907
772.904
772.901
772.899
772.896
772.894
772.892
772.891
772.89
772.889
772.889
772.89
772.891
772.892
772.894
772.897
772.899
772.902
772.906
772.909
772.913
772.917
772.921
772.925
772.929
772.933
772.936
772.94
772.943
772.947
772.95
772.953
772.955
772.958
772.96
772.962
772.964
772.966
772.967
772.969
772.97
772.971
772.972
772.972
772.973
772.974
772.974
772.974
772.975
772.975
772.975
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.973
772.973
772.973
772.972
772.971
772.971
772.97
772.968
772.967
772.966
772.964
772.962
772.959
772.957
772.954
772.951
772.948
772.945
772.942
772.938
772.935
772.931
772.928
772.925
772.922
772.92
772.918
772.916
772.914
772.913
772.913
772.913
772.913
772.914
772.916
772.918
772.92
772.923
772.926
772.929
772.933
772.936
772.94
772.944
772.948
772.952
772.956
772.96
772.963
772.967
772.97
772.973
772.976
772.979
772.981
772.984
772.986
772.988
772.989
772.991
772.992
772.993
772.994
772.995
772.996
772.997
772.997
772.998
772.998
772.998
772.999
772.999
772.999
772.999
772.999
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773.001
773.001
773.001
773.001
773.001
773.001
773.002
773.002
773.002
773.003
773.003
773.004
773.005
773.005
773.006
773.007
773.008
773.009
773.011
773.012
773.014
773.015
773.017
773.019
773.022
773.024
773.027
773.029
773.032
773.036
773.039
773.043
773.047
773.051
773.055
773.059
773.064
773.069
773.074
773.08
773.085
773.091
773.097
773.104
773.11
773.117
773.124
773.131
773.139
773.147
773.155
773.163
773.171
773.18
773.189
773.198
773.208
773.217
773.227
773.238
773.248
773.259
773.27
773.281
773.292
773.304
773.316
773.328
773.34
773.353
773.366
773.379
773.392
773.406
773.42
773.434
773.448
773.463
773.478
773.493
773.508
773.524
773.54
773.556
773.572
773.589
773.605
773.623
773.64
773.657
773.675
773.693
773.712
773.73
773.749
773.768
773.788
773.807
773.827
773.847
773.867
773.888
773.909
773.93
773.951
773.972
773.994
774.016
774.038
774.061
774.084
774.107
774.13
774.153
774.177
774.201
774.225
774.25
774.274
774.299
774.324
774.35
774.375
774.401
774.427
774.453
774.48
774.507
774.533
774.561
774.588
774.616
774.644
774.672
774.7
774.729
774.757
774.786
774.816
774.845
774.875
774.904
774.935
774.965
774.995
775.026
775.057
775.088
775.119
775.151
775.183
775.215
775.247
775.279
775.312
775.344
775.377
775.411
775.444
775.477
775.511
775.545
775.579
775.613
775.648
775.683
775.717
775.753
775.788
775.823
775.859
775.894
775.93
775.966
776.003
776.039
776.076
776.112
776.149
776.186
776.224
776.261
776.299
776.336
776.374
776.412
776.45
776.489
776.527
776.566
776.605
776.643
776.682
776.722
776.761
776.8
776.84
776.88
776.919
776.959
777
777.04
777.08
777.12
777.161
777.202
777.243
777.283
777.324
777.366
777.407
777.448
777.49
777.531
777.573
777.614
777.656
777.698
777.74
777.782
777.824
777.867
777.909
777.952
777.994
778.037
778.079
778.122
778.165
778.208
778.251
778.294
778.337
778.38
778.423
778.466
778.509
778.553
778.596
778.64
778.683
778.727
778.77
778.815
778.857
778.902
778.944
778.99
779.032
779.078
779.119
779.165
779.207
779.255
773.026
773.003
772.999
773
773.002
773.003
773.002
772.999
772.995
772.993
772.993
772.992
772.991
772.985
772.954
772.84
772.691
772.599
772.568
772.571
772.622
772.771
772.894
772.952
772.968
772.967
772.949
772.922
772.905
772.895
772.888
772.885
772.883
772.882
772.88
772.878
772.875
772.873
772.871
772.869
772.867
772.866
772.865
772.865
772.865
772.866
772.867
772.869
772.871
772.873
772.876
772.879
772.883
772.886
772.89
772.894
772.898
772.902
772.906
772.909
772.913
772.917
772.92
772.923
772.926
772.929
772.932
772.934
772.936
772.938
772.94
772.942
772.943
772.944
772.945
772.946
772.947
772.947
772.948
772.948
772.949
772.949
772.949
772.949
772.95
772.95
772.95
772.95
772.95
772.949
772.949
772.949
772.949
772.948
772.948
772.947
772.947
772.946
772.945
772.944
772.942
772.941
772.939
772.937
772.935
772.932
772.929
772.927
772.924
772.92
772.917
772.914
772.911
772.907
772.904
772.901
772.899
772.896
772.894
772.892
772.891
772.89
772.889
772.889
772.89
772.891
772.892
772.894
772.897
772.899
772.902
772.906
772.909
772.913
772.917
772.921
772.925
772.929
772.933
772.936
772.94
772.943
772.947
772.95
772.953
772.955
772.958
772.96
772.962
772.964
772.966
772.967
772.969
772.97
772.971
772.972
772.972
772.973
772.974
772.974
772.974
772.975
772.975
772.975
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.973
772.973
772.973
772.972
772.971
772.971
772.97
772.968
772.967
772.966
772.964
772.962
772.959
772.957
772.954
772.951
772.948
772.945
772.942
772.938
772.935
772.931
772.928
772.925
772.922
772.92
772.918
772.916
772.914
772.913
772.913
772.913
772.913
772.914
772.916
772.918
772.92
772.923
772.926
772.929
772.933
772.936
772.94
772.944
772.948
772.952
772.956
772.96
772.963
772.967
772.97
772.973
772.976
772.979
772.981
772.984
772.986
772.988
772.989
772.991
772.992
772.993
772.994
772.995
772.996
772.997
772.997
772.998
772.998
772.998
772.999
772.999
772.999
772.999
772.999
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773.001
773.001
773.001
773.001
773.001
773.001
773.002
773.002
773.002
773.003
773.003
773.004
773.005
773.005
773.006
773.007
773.008
773.009
773.011
773.012
773.014
773.015
773.017
773.019
773.022
773.024
773.027
773.029
773.032
773.036
773.039
773.043
773.047
773.051
773.055
773.059
773.064
773.069
773.074
773.08
773.085
773.091
773.097
773.104
773.11
773.117
773.124
773.131
773.139
773.147
773.155
773.163
773.171
773.18
773.189
773.198
773.208
773.217
773.227
773.238
773.248
773.259
773.27
773.281
773.292
773.304
773.316
773.328
773.34
773.353
773.366
773.379
773.392
773.406
773.42
773.434
773.448
773.463
773.478
773.493
773.508
773.524
773.54
773.556
773.572
773.589
773.605
773.623
773.64
773.657
773.675
773.693
773.712
773.73
773.749
773.768
773.788
773.807
773.827
773.847
773.867
773.888
773.909
773.93
773.951
773.972
773.994
774.016
774.038
774.061
774.084
774.107
774.13
774.153
774.177
774.201
774.225
774.25
774.274
774.299
774.324
774.35
774.375
774.401
774.427
774.453
774.48
774.507
774.533
774.561
774.588
774.616
774.644
774.672
774.7
774.729
774.757
774.786
774.816
774.845
774.875
774.904
774.935
774.965
774.995
775.026
775.057
775.088
775.119
775.151
775.183
775.215
775.247
775.279
775.312
775.344
775.377
775.411
775.444
775.477
775.511
775.545
775.579
775.613
775.648
775.683
775.717
775.753
775.788
775.823
775.859
775.894
775.93
775.966
776.003
776.039
776.076
776.112
776.149
776.186
776.224
776.261
776.299
776.336
776.374
776.412
776.45
776.489
776.527
776.566
776.605
776.643
776.682
776.722
776.761
776.8
776.84
776.88
776.919
776.959
777
777.04
777.08
777.12
777.161
777.202
777.243
777.283
777.324
777.366
777.407
777.448
777.49
777.531
777.573
777.614
777.656
777.698
777.74
777.782
777.824
777.867
777.909
777.952
777.994
778.037
778.079
778.122
778.165
778.208
778.251
778.294
778.337
778.38
778.423
778.466
778.509
778.553
778.596
778.64
778.683
778.727
778.77
778.815
778.857
778.902
778.944
778.99
779.032
779.078
779.119
779.165
779.207
779.255
772.94
772.93
772.924
772.915
772.913
772.912
772.913
772.915
772.916
772.917
772.918
772.92
772.925
772.929
772.931
772.93
772.916
772.867
772.818
772.795
772.791
772.799
772.831
772.863
772.881
772.889
772.892
772.893
772.892
772.891
772.89
772.888
772.886
772.884
772.881
772.878
772.876
772.873
772.871
772.869
772.867
772.866
772.865
772.865
772.865
772.866
772.867
772.869
772.871
772.873
772.876
772.879
772.883
772.886
772.89
772.894
772.898
772.902
772.906
772.909
772.913
772.917
772.92
772.923
772.926
772.929
772.932
772.934
772.936
772.938
772.94
772.942
772.943
772.944
772.945
772.946
772.947
772.947
772.948
772.948
772.949
772.949
772.949
772.949
772.95
772.95
772.95
772.95
772.95
772.949
772.949
772.949
772.949
772.948
772.948
772.947
772.947
772.946
772.945
772.944
772.942
772.941
772.939
772.937
772.935
772.932
772.929
772.927
772.924
772.92
772.917
772.914
772.911
772.907
772.904
772.901
772.899
772.896
772.894
772.892
772.891
772.89
772.889
772.889
772.89
772.891
772.892
772.894
772.897
772.899
772.902
772.906
772.909
772.913
772.917
772.921
772.925
772.929
772.933
772.936
772.94
772.943
772.947
772.95
772.953
772.955
772.958
772.96
772.962
772.964
772.966
772.967
772.969
772.97
772.971
772.972
772.972
772.973
772.974
772.974
772.974
772.975
772.975
772.975
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.973
772.973
772.973
772.972
772.971
772.971
772.97
772.968
772.967
772.966
772.964
772.962
772.959
772.957
772.954
772.951
772.948
772.945
772.942
772.938
772.935
772.931
772.928
772.925
772.922
772.92
772.918
772.916
772.914
772.913
772.913
772.913
772.913
772.914
772.916
772.918
772.92
772.923
772.926
772.929
772.933
772.936
772.94
772.944
772.948
772.952
772.956
772.96
772.963
772.967
772.97
772.973
772.976
772.979
772.981
772.984
772.986
772.988
772.989
772.991
772.992
772.993
772.994
772.995
772.996
772.997
772.997
772.998
772.998
772.998
772.999
772.999
772.999
772.999
772.999
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773.001
773.001
773.001
773.001
773.001
773.001
773.002
773.002
773.002
773.003
773.003
773.004
773.005
773.005
773.006
773.007
773.008
773.009
773.011
773.012
773.014
773.015
773.017
773.019
773.022
773.024
773.027
773.029
773.032
773.036
773.039
773.043
773.047
773.051
773.055
773.059
773.064
773.069
773.074
773.08
773.085
773.091
773.097
773.104
773.11
773.117
773.124
773.131
773.139
773.147
773.155
773.163
773.171
773.18
773.189
773.198
773.208
773.217
773.227
773.238
773.248
773.259
773.27
773.281
773.292
773.304
773.316
773.328
773.34
773.353
773.366
773.379
773.392
773.406
773.42
773.434
773.448
773.463
773.478
773.493
773.508
773.524
773.54
773.556
773.572
773.589
773.605
773.623
773.64
773.657
773.675
773.693
773.712
773.73
773.749
773.768
773.788
773.807
773.827
773.847
773.867
773.888
773.909
773.93
773.951
773.972
773.994
774.016
774.038
774.061
774.084
774.107
774.13
774.153
774.177
774.201
774.225
774.25
774.274
774.299
774.324
774.35
774.375
774.401
774.427
774.453
774.48
774.507
774.533
774.561
774.588
774.616
774.644
774.672
774.7
774.729
774.757
774.786
774.816
774.845
774.875
774.904
774.935
774.965
774.995
775.026
775.057
775.088
775.119
775.151
775.183
775.215
775.247
775.279
775.312
775.344
775.377
775.411
775.444
775.477
775.511
775.545
775.579
775.613
775.648
775.683
775.717
775.753
775.788
775.823
775.859
775.894
775.93
775.966
776.003
776.039
776.076
776.112
776.149
776.186
776.224
776.261
776.299
776.336
776.374
776.412
776.45
776.489
776.527
776.566
776.605
776.643
776.682
776.722
776.761
776.8
776.84
776.88
776.919
776.959
777
777.04
777.08
777.12
777.161
777.202
777.243
777.283
777.324
777.366
777.407
777.448
777.49
777.531
777.573
777.614
777.656
777.698
777.74
777.782
777.824
777.867
777.909
777.952
777.994
778.037
778.079
778.122
778.165
778.208
778.251
778.294
778.337
778.38
778.423
778.466
778.509
778.553
778.596
778.64
778.683
778.727
778.77
778.815
778.857
778.902
778.944
778.99
779.032
779.078
779.119
779.165
779.207
779.255
773.095
773.107
773.117
773.123
773.124
773.124
773.124
773.123
773.12
773.116
773.111
773.105
773.1
773.096
773.091
773.078
773.034
772.954
772.888
772.846
772.824
772.82
772.823
772.842
772.869
772.887
772.898
772.904
772.905
772.904
772.901
772.897
772.893
772.888
772.884
772.88
772.877
772.874
772.872
772.869
772.868
772.866
772.865
772.865
772.865
772.866
772.867
772.869
772.871
772.873
772.876
772.879
772.883
772.886
772.89
772.894
772.898
772.902
772.906
772.909
772.913
772.917
772.92
772.923
772.926
772.929
772.932
772.934
772.936
772.938
772.94
772.942
772.943
772.944
772.945
772.946
772.947
772.947
772.948
772.948
772.949
772.949
772.949
772.949
772.95
772.95
772.95
772.95
772.95
772.949
772.949
772.949
772.949
772.948
772.948
772.947
772.947
772.946
772.945
772.944
772.942
772.941
772.939
772.937
772.935
772.932
772.929
772.927
772.924
772.92
772.917
772.914
772.911
772.907
772.904
772.901
772.899
772.896
772.894
772.892
772.891
772.89
772.889
772.889
772.89
772.891
772.892
772.894
772.897
772.899
772.902
772.906
772.909
772.913
772.917
772.921
772.925
772.929
772.933
772.936
772.94
772.943
772.947
772.95
772.953
772.955
772.958
772.96
772.962
772.964
772.966
772.967
772.969
772.97
772.971
772.972
772.972
772.973
772.974
772.974
772.974
772.975
772.975
772.975
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.973
772.973
772.973
772.972
772.971
772.971
772.97
772.968
772.967
772.966
772.964
772.962
772.959
772.957
772.954
772.951
772.948
772.945
772.942
772.938
772.935
772.931
772.928
772.925
772.922
772.92
772.918
772.916
772.914
772.913
772.913
772.913
772.913
772.914
772.916
772.918
772.92
772.923
772.926
772.929
772.933
772.936
772.94
772.944
772.948
772.952
772.956
772.96
772.963
772.967
772.97
772.973
772.976
772.979
772.981
772.984
772.986
772.988
772.989
772.991
772.992
772.993
772.994
772.995
772.996
772.997
772.997
772.998
772.998
772.998
772.999
772.999
772.999
772.999
772.999
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773.001
773.001
773.001
773.001
773.001
773.001
773.002
773.002
773.002
773.003
773.003
773.004
773.005
773.005
773.006
773.007
773.008
773.009
773.011
773.012
773.014
773.015
773.017
773.019
773.022
773.024
773.027
773.029
773.032
773.036
773.039
773.043
773.047
773.051
773.055
773.059
773.064
773.069
773.074
773.08
773.085
773.091
773.097
773.104
773.11
773.117
773.124
773.131
773.139
773.147
773.155
773.163
773.171
773.18
773.189
773.198
773.208
773.217
773.227
773.238
773.248
773.259
773.27
773.281
773.292
773.304
773.316
773.328
773.34
773.353
773.366
773.379
773.392
773.406
773.42
773.434
773.448
773.463
773.478
773.493
773.508
773.524
773.54
773.556
773.572
773.589
773.605
773.623
773.64
773.657
773.675
773.693
773.712
773.73
773.749
773.768
773.788
773.807
773.827
773.847
773.867
773.888
773.909
773.93
773.951
773.972
773.994
774.016
774.038
774.061
774.084
774.107
774.13
774.153
774.177
774.201
774.225
774.25
774.274
774.299
774.324
774.35
774.375
774.401
774.427
774.453
774.48
774.507
774.533
774.561
774.588
774.616
774.644
774.672
774.7
774.729
774.757
774.786
774.816
774.845
774.875
774.904
774.935
774.965
774.995
775.026
775.057
775.088
775.119
775.151
775.183
775.215
775.247
775.279
775.312
775.344
775.377
775.411
775.444
775.477
775.511
775.545
775.579
775.613
775.648
775.683
775.717
775.753
775.788
775.823
775.859
775.894
775.93
775.966
776.003
776.039
776.076
776.112
776.149
776.186
776.224
776.261
776.299
776.336
776.374
776.412
776.45
776.489
776.527
776.566
776.605
776.643
776.682
776.722
776.761
776.8
776.84
776.88
776.919
776.959
777
777.04
777.08
777.12
777.161
777.202
777.243
777.283
777.324
777.366
777.407
777.448
777.49
777.531
777.573
777.614
777.656
777.698
777.74
777.782
777.824
777.867
777.909
777.952
777.994
778.037
778.079
778.122
778.165
778.208
778.251
778.294
778.337
778.38
778.423
778.466
778.509
778.553
778.596
778.64
778.683
778.727
778.77
778.815
778.857
778.902
778.944
778.99
779.032
779.078
779.119
779.165
779.207
779.255
772.8
772.814
772.814
772.814
772.814
772.815
772.814
772.814
772.814
772.817
772.823
772.829
772.833
772.837
772.848
772.871
772.883
772.886
772.878
772.832
772.767
772.733
772.727
772.735
772.775
772.829
772.864
772.885
772.896
772.899
772.899
772.897
772.893
772.889
772.885
772.881
772.877
772.874
772.872
772.869
772.868
772.866
772.865
772.865
772.865
772.866
772.867
772.869
772.871
772.873
772.876
772.879
772.883
772.886
772.89
772.894
772.898
772.902
772.906
772.909
772.913
772.917
772.92
772.923
772.926
772.929
772.932
772.934
772.936
772.938
772.94
772.942
772.943
772.944
772.945
772.946
772.947
772.947
772.948
772.948
772.949
772.949
772.949
772.949
772.95
772.95
772.95
772.95
772.95
772.949
772.949
772.949
772.949
772.948
772.948
772.947
772.947
772.946
772.945
772.944
772.942
772.941
772.939
772.937
772.935
772.932
772.929
772.927
772.924
772.92
772.917
772.914
772.911
772.907
772.904
772.901
772.899
772.896
772.894
772.892
772.891
772.89
772.889
772.889
772.89
772.891
772.892
772.894
772.897
772.899
772.902
772.906
772.909
772.913
772.917
772.921
772.925
772.929
772.933
772.936
772.94
772.943
772.947
772.95
772.953
772.955
772.958
772.96
772.962
772.964
772.966
772.967
772.969
772.97
772.971
772.972
772.972
772.973
772.974
772.974
772.974
772.975
772.975
772.975
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.973
772.973
772.973
772.972
772.971
772.971
772.97
772.968
772.967
772.966
772.964
772.962
772.959
772.957
772.954
772.951
772.948
772.945
772.942
772.938
772.935
772.931
772.928
772.925
772.922
772.92
772.918
772.916
772.914
772.913
772.913
772.913
772.913
772.914
772.916
772.918
772.92
772.923
772.926
772.929
772.933
772.936
772.94
772.944
772.948
772.952
772.956
772.96
772.963
772.967
772.97
772.973
772.976
772.979
772.981
772.984
772.986
772.988
772.989
772.991
772.992
772.993
772.994
772.995
772.996
772.997
772.997
772.998
772.998
772.998
772.999
772.999
772.999
772.999
772.999
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773.001
773.001
773.001
773.001
773.001
773.001
773.002
773.002
773.002
773.003
773.003
773.004
773.005
773.005
773.006
773.007
773.008
773.009
773.011
773.012
773.014
773.015
773.017
773.019
773.022
773.024
773.027
773.029
773.032
773.036
773.039
773.043
773.047
773.051
773.055
773.059
773.064
773.069
773.074
773.08
773.085
773.091
773.097
773.104
773.11
773.117
773.124
773.131
773.139
773.147
773.155
773.163
773.171
773.18
773.189
773.198
773.208
773.217
773.227
773.238
773.248
773.259
773.27
773.281
773.292
773.304
773.316
773.328
773.34
773.353
773.366
773.379
773.392
773.406
773.42
773.434
773.448
773.463
773.478
773.493
773.508
773.524
773.54
773.556
773.572
773.589
773.605
773.623
773.64
773.657
773.675
773.693
773.712
773.73
773.749
773.768
773.788
773.807
773.827
773.847
773.867
773.888
773.909
773.93
773.951
773.972
773.994
774.016
774.038
774.061
774.084
774.107
774.13
774.153
774.177
774.201
774.225
774.25
774.274
774.299
774.324
774.35
774.375
774.401
774.427
774.453
774.48
774.507
774.533
774.561
774.588
774.616
774.644
774.672
774.7
774.729
774.757
774.786
774.816
774.845
774.875
774.904
774.935
774.965
774.995
775.026
775.057
775.088
775.119
775.151
775.183
775.215
775.247
775.279
775.312
775.344
775.377
775.411
775.444
775.477
775.511
775.545
775.579
775.613
775.648
775.683
775.717
775.753
775.788
775.823
775.859
775.894
775.93
775.966
776.003
776.039
776.076
776.112
776.149
776.186
776.224
776.261
776.299
776.336
776.374
776.412
776.45
776.489
776.527
776.566
776.605
776.643
776.682
776.722
776.761
776.8
776.84
776.88
776.919
776.959
777
777.04
777.08
777.12
777.161
777.202
777.243
777.283
777.324
777.366
777.407
777.448
777.49
777.531
777.573
777.614
777.656
777.698
777.74
777.782
777.824
777.867
777.909
777.952
777.994
778.037
778.079
778.122
778.165
778.208
778.251
778.294
778.337
778.38
778.423
778.466
778.509
778.553
778.596
778.64
778.683
778.727
778.77
778.815
778.857
778.902
778.944
778.99
779.032
779.078
779.119
779.165
779.207
779.255
773.096
773.12
773.127
773.129
773.129
773.129
773.128
773.128
773.131
773.133
773.133
773.133
773.138
773.149
773.152
773.151
773.141
773.088
772.969
772.876
772.821
772.796
772.793
772.801
772.834
772.871
772.894
772.906
772.91
772.91
772.908
772.902
772.897
772.891
772.886
772.882
772.878
772.875
772.872
772.87
772.868
772.866
772.865
772.865
772.865
772.866
772.867
772.869
772.871
772.873
772.876
772.879
772.883
772.886
772.89
772.894
772.898
772.902
772.906
772.909
772.913
772.917
772.92
772.923
772.926
772.929
772.932
772.934
772.936
772.938
772.94
772.942
772.943
772.944
772.945
772.946
772.947
772.947
772.948
772.948
772.949
772.949
772.949
772.949
772.95
772.95
772.95
772.95
772.95
772.949
772.949
772.949
772.949
772.948
772.948
772.947
772.947
772.946
772.945
772.944
772.942
772.941
772.939
772.937
772.935
772.932
772.929
772.927
772.924
772.92
772.917
772.914
772.911
772.907
772.904
772.901
772.899
772.896
772.894
772.892
772.891
772.89
772.889
772.889
772.89
772.891
772.892
772.894
772.897
772.899
772.902
772.906
772.909
772.913
772.917
772.921
772.925
772.929
772.933
772.936
772.94
772.943
772.947
772.95
772.953
772.955
772.958
772.96
772.962
772.964
772.966
772.967
772.969
772.97
772.971
772.972
772.972
772.973
772.974
772.974
772.974
772.975
772.975
772.975
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.973
772.973
772.973
772.972
772.971
772.971
772.97
772.968
772.967
772.966
772.964
772.962
772.959
772.957
772.954
772.951
772.948
772.945
772.942
772.938
772.935
772.931
772.928
772.925
772.922
772.92
772.918
772.916
772.914
772.913
772.913
772.913
772.913
772.914
772.916
772.918
772.92
772.923
772.926
772.929
772.933
772.936
772.94
772.944
772.948
772.952
772.956
772.96
772.963
772.967
772.97
772.973
772.976
772.979
772.981
772.984
772.986
772.988
772.989
772.991
772.992
772.993
772.994
772.995
772.996
772.997
772.997
772.998
772.998
772.998
772.999
772.999
772.999
772.999
772.999
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773.001
773.001
773.001
773.001
773.001
773.001
773.002
773.002
773.002
773.003
773.003
773.004
773.005
773.005
773.006
773.007
773.008
773.009
773.011
773.012
773.014
773.015
773.017
773.019
773.022
773.024
773.027
773.029
773.032
773.036
773.039
773.043
773.047
773.051
773.055
773.059
773.064
773.069
773.074
773.08
773.085
773.091
773.097
773.104
773.11
773.117
773.124
773.131
773.139
773.147
773.155
773.163
773.171
773.18
773.189
773.198
773.208
773.217
773.227
773.238
773.248
773.259
773.27
773.281
773.292
773.304
773.316
773.328
773.34
773.353
773.366
773.379
773.392
773.406
773.42
773.434
773.448
773.463
773.478
773.493
773.508
773.524
773.54
773.556
773.572
773.589
773.605
773.623
773.64
773.657
773.675
773.693
773.712
773.73
773.749
773.768
773.788
773.807
773.827
773.847
773.867
773.888
773.909
773.93
773.951
773.972
773.994
774.016
774.038
774.061
774.084
774.107
774.13
774.153
774.177
774.201
774.225
774.25
774.274
774.299
774.324
774.35
774.375
774.401
774.427
774.453
774.48
774.507
774.533
774.561
774.588
774.616
774.644
774.672
774.7
774.729
774.757
774.786
774.816
774.845
774.875
774.904
774.935
774.965
774.995
775.026
775.057
775.088
775.119
775.151
775.183
775.215
775.247
775.279
775.312
775.344
775.377
775.411
775.444
775.477
775.511
775.545
775.579
775.613
775.648
775.683
775.717
775.753
775.788
775.823
775.859
775.894
775.93
775.966
776.003
776.039
776.076
776.112
776.149
776.186
776.224
776.261
776.299
776.336
776.374
776.412
776.45
776.489
776.527
776.566
776.605
776.643
776.682
776.722
776.761
776.8
776.84
776.88
776.919
776.959
777
777.04
777.08
777.12
777.161
777.202
777.243
777.283
777.324
777.366
777.407
777.448
777.49
777.531
777.573
777.614
777.656
777.698
777.74
777.782
777.824
777.867
777.909
777.952
777.994
778.037
778.079
778.122
778.165
778.208
778.251
778.294
778.337
778.38
778.423
778.466
778.509
778.553
778.596
778.64
778.683
778.727
778.77
778.815
778.857
778.902
778.944
778.99
779.032
779.078
779.119
779.165
779.207
779.255
772.892
772.936
772.945
772.947
772.95
772.954
772.954
772.954
772.954
772.957
772.968
772.978
772.981
772.982
772.985
773.004
773.081
773.15
773.172
773.172
773.149
773.087
773.032
772.997
772.975
772.96
772.949
772.939
772.929
772.921
772.912
772.905
772.898
772.892
772.887
772.882
772.878
772.875
772.872
772.87
772.868
772.866
772.865
772.865
772.865
772.866
772.867
772.869
772.871
772.873
772.876
772.879
772.883
772.886
772.89
772.894
772.898
772.902
772.906
772.909
772.913
772.917
772.92
772.923
772.926
772.929
772.932
772.934
772.936
772.938
772.94
772.942
772.943
772.944
772.945
772.946
772.947
772.947
772.948
772.948
772.949
772.949
772.949
772.949
772.95
772.95
772.95
772.95
772.95
772.949
772.949
772.949
772.949
772.948
772.948
772.947
772.947
772.946
772.945
772.944
772.942
772.941
772.939
772.937
772.935
772.932
772.929
772.927
772.924
772.92
772.917
772.914
772.911
772.907
772.904
772.901
772.899
772.896
772.894
772.892
772.891
772.89
772.889
772.889
772.89
772.891
772.892
772.894
772.897
772.899
772.902
772.906
772.909
772.913
772.917
772.921
772.925
772.929
772.933
772.936
772.94
772.943
772.947
772.95
772.953
772.955
772.958
772.96
772.962
772.964
772.966
772.967
772.969
772.97
772.971
772.972
772.972
772.973
772.974
772.974
772.974
772.975
772.975
772.975
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.975
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.974
772.973
772.973
772.973
772.972
772.971
772.971
772.97
772.968
772.967
772.966
772.964
772.962
772.959
772.957
772.954
772.951
772.948
772.945
772.942
772.938
772.935
772.931
772.928
772.925
772.922
772.92
772.918
772.916
772.914
772.913
772.913
772.913
772.913
772.914
772.916
772.918
772.92
772.923
772.926
772.929
772.933
772.936
772.94
772.944
772.948
772.952
772.956
772.96
772.963
772.967
772.97
772.973
772.976
772.979
772.981
772.984
772.986
772.988
772.989
772.991
772.992
772.993
772.994
772.995
772.996
772.997
772.997
772.998
772.998
772.998
772.999
772.999
772.999
772.999
772.999
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773
773.001
773.001
773.001
773.001
773.001
773.001
773.002
773.002
773.002
773.003
773.003
773.004
773.005
773.005
773.006
773.007
773.008
773.009
773.011
773.012
773.014
773.015
773.017
773.019
773.022
773.024
773.027
773.029
773.032
773.036
773.039
773.043
773.047
773.051
773.055
773.059
773.064
773.069
773.074
773.08
773.085
773.091
773.097
773.104
773.11
773.117
773.124
773.131
773.139
773.147
773.155
773.163
773.171
773.18
773.189
773.198
773.208
773.217
773.227
773.238
773.248
773.259
773.27
773.281
773.292
773.304
773.316
773.328
773.34
773.353
773.366
773.379
773.392
773.406
773.42
773.434
773.448
773.463
773.478
773.493
773.508
773.524
773.54
773.556
773.572
773.589
773.605
773.623
773.64
773.657
773.675
773.693
773.712
773.73
773.749
773.768
773.788
773.807
773.827
773.847
773.867
773.888
773.909
773.93
773.951
773.972
773.994
774.016
774.038
774.061
774.084
774.107
774.13
774.153
774.177
774.201
774.225
774.25
774.274
774.299
774.324
774.35
774.375
774.401
774.427
774.453
774.48
774.507
774.533
774.561
774.588
774.616
774.644
774.672
774.7
774.729
774.757
774.786
774.816
774.845
774.875
774.904
774.935
774.965
774.995
775.026
775.057
775.088
775.119
775.151
775.183
775.215
775.247
775.279
775.312
775.344
775.377
775.411
775.444
775.477
775.511
775.545
775.579
775.613
775.648
775.683
775.717
775.753
775.788
775.823
775.859
775.894
775.93
775.966
776.003
776.039
776.076
776.112
776.149
776.186
776.224
776.261
776.299
776.336
776.374
776.412
776.45
776.489
776.527
776.566
776.605
776.643
776.682
776.722
776.761
776.8
776.84
776.88
776.919
776.959
777
777.04
777.08
777.12
777.161
777.202
777.243
777.283
777.324
777.366
777.407
777.448
777.49
777.531
777.573
777.614
777.656
777.698
777.74
777.782
777.824
777.867
777.909
777.952
777.994
778.037
778.079
778.122
778.165
778.208
778.251
778.294
778.337
778.38
778.423
778.466
778.509
778.553
778.596
778.64
778.683
778.727
778.77
778.815
778.857
778.902
778.944
778.99
779.032
779.078
779.119
779.165
779.207
779.255
773.138
773.163
773.167
773.168
773.169
773.171
773.173
773.173
773.172
773.157
773.109
773.077
773.073
773.093
773.231
773.704
774.226
774.557
774.708
774.743
774.721
774.557
774.148
773.775
773.491
773.287
773.147
773.055
772.995
772.957
772.932
772.916
772.905
772.896
772.89
772.885
772.88
772.877
772.874
772.872
772.87
772.868
772.867
772.867
772.867
772.868
772.869
772.871
772.873
772.875
772.878
772.881
772.884
772.888
772.892
772.896
772.9
772.904
772.908
772.911
772.915
772.919
772.922
772.925
772.928
772.931
772.934
772.936
772.938
772.94
772.942
772.944
772.945
772.946
772.947
772.948
772.949
772.949
772.95
772.95
772.951
772.951
772.951
772.951
772.951
772.952
772.952
772.952
772.951
772.951
772.951
772.951
772.951
772.95
772.95
772.949
772.949
772.948
772.947
772.946
772.944
772.943
772.941
772.939
772.937
772.934
772.931
772.928
772.925
772.922
772.919
772.916
772.912
772.909
772.906
772.903
772.9
772.898
772.896
772.894
772.893
772.892
772.891
772.891
772.892
772.893
772.894
772.896
772.899
772.901
772.904
772.908
772.911
772.915
772.919
772.923
772.927
772.931
772.934
772.938
772.942
772.945
772.949
772.952
772.955
772.957
772.96
772.962
772.964
772.966
772.968
772.969
772.971
772.972
772.973
772.974
772.974
772.975
772.976
772.976
772.976
772.977
772.977
772.977
772.977
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.978
772.977
772.977
772.977
772.977
772.977
772.977
772.977
772.977
772.977
772.977
772.977
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.976
772.975
772.975
772.975
772.975
772.974
772.973
772.973
772.972
772.97
772.969
772.967
772.966
772.964
772.961
772.959
772.956
772.953
772.95
772.947
772.943
772.94
772.937
772.933
772.93
772.927
772.924
772.922
772.919
772.918
772.916
772.915
772.915
772.915
772.915
772.916
772.918
772.92
772.922
772.925
772.928
772.931
772.935
772.938
772.942
772.946
772.95
772.954
772.958
772.962
772.965
772.969
772.972
772.975
772.978
772.981
772.983
772.986
772.988
772.989
772.991
772.993
772.994
772.995
772.996
772.997
772.998
772.998
772.999
773
773
773
773.001
773.001
773.001
773.001
773.001
773.001
773.002
773.002
773.002
773.002
773.002
773.002
773.002
773.002
773.002
773.002
773.002
773.002
773.002
773.002
773.002
773.002
773.002
773.002
773.002
773.003
773.003
773.003
773.003
773.003
773.004
773.004
773.004
773.005
773.005
773.006
773.006
773.007
773.008
773.009
773.01
773.011
773.012
773.014
773.016
773.017
773.019
773.021
773.023
773.026
773.029
773.031
773.034
773.038
773.041
773.045
773.048
773.053
773.057
773.061
773.066
773.071
773.076
773.082
773.087
773.093
773.099
773.106
773.112
773.119
773.126
773.133
773.141
773.149
773.157
773.165
773.173
773.182
773.191
773.2
773.21
773.219
773.229
773.24
773.25
773.261
773.272
773.283
773.294
773.306
773.318
773.33
773.342
773.355
773.368
773.381
773.394
773.408
773.422
773.436
773.45
773.465
773.48
773.495
773.51
773.526
773.541
773.558
773.574
773.591
773.607
773.624
773.642
773.659
773.677
773.695
773.714
773.732
773.751
773.77
773.789
773.809
773.829
773.849
773.869
773.89
773.91
773.931
773.953
773.974
773.996
774.018
774.04
774.063
774.086
774.109
774.132
774.155
774.179
774.203
774.227
774.251
774.276
774.301
774.326
774.351
774.377
774.403
774.429
774.455
774.482
774.508
774.535
774.563
774.59
774.618
774.645
774.674
774.702
774.73
774.759
774.788
774.817
774.847
774.876
774.906
774.936
774.967
774.997
775.028
775.059
775.09
775.121
775.153
775.185
775.216
775.249
775.281
775.314
775.346
775.379
775.412
775.446
775.479
775.513
775.547
775.581
775.615
775.65
775.684
775.719
775.754
775.789
775.825
775.86
775.896
775.932
775.968
776.004
776.041
776.077
776.114
776.151
776.188
776.225
776.263
776.3
776.338
776.376
776.414
776.452
776.49
776.529
776.567
776.606
776.645
776.684
776.723
776.763
776.802
776.842
776.881
776.921
776.961
777.001
777.041
777.082
777.122
777.163
777.203
777.244
777.285
777.326
777.367
777.408
777.45
777.491
777.533
777.574
777.616
777.658
777.7
777.742
777.784
777.826
777.868
777.911
777.953
777.996
778.038
778.081
778.124
778.166
778.209
778.252
778.295
778.338
778.381
778.424
778.468
778.511
778.555
778.597
778.642
778.684
778.729
778.771
778.816
778.858
778.904
778.946
778.991
779.033
779.079
779.121
779.167
779.208
779.256
)
;
boundaryField
{
inlet
{
type zeroGradient;
}
outlet
{
type zeroGradient;
}
sides
{
type empty;
}
walls
{
type zeroGradient;
}
}
// ************************************************************************* //
| |
f414caacbc7114ab2f5ae5aaf228083d880ffaae | 605c255ad89ac141e5d02303727a8454ef4df8dc | /src/vue/include/CaseGraphique.hpp | a55d3652b34a21dbe6985ec86bad3b56da057182 | [] | no_license | wojiaodawei/game-of-frog | 07284a743a866a760a96ef59f16a6b03690009f1 | 6333f1da3fef5868c5faec1b0517421b5e817123 | refs/heads/master | 2021-02-09T16:41:05.006569 | 2020-03-02T07:45:00 | 2020-03-02T07:45:00 | 244,303,340 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,644 | hpp | CaseGraphique.hpp | #ifndef CaseGraphique_hpp
#define CaseGraphique_hpp
#include <gtkmm/eventbox.h>
#include <gtkmm/image.h>
#include <map>
#include <memory>
#include <string>
// Déclarations incomplètes des classes Presentateur et GrenouillolandGraphique.
class Presentateur;
class GrenouillolandGraphique;
/**
* @class CaseGraphique CaseGraphique.hpp
*
* Déclaration de la classe CaseGraphique représentant graphiquement une
* case du modèle.
*
* @note Chaque instance de cette classe est son propre listener.
*/
class CaseGraphique: public Gtk::EventBox {
public:
// Déclaration d'amitié envers la classe GrenouillolandGraphique.
friend class GrenouillolandGraphique;
// Renommage de type local.
typedef std::unique_ptr< Gtk::Image > Pointer;
public:
/**
* Constructeur logique.
*
* @param[in,out] grenouilloland - la valeur de @ref grenouillolandGraphique_.
* @param[in] ligne - la valeur de @ref ligne_.
* @param[in] colonne - la valeur de @ref colonne_.
*/
CaseGraphique(GrenouillolandGraphique& grenouillolandGraphique,
const int& ligne,
const int& colonne);
/**
* Constructeur par recopie.
*
* @param[in] autre - l'instance a recopier.
*/
CaseGraphique(const CaseGraphique& autre) = delete;
public:
/**
* Accesseur.
*
* @return la valeur de @ref grenouillolandGraphique_.
*/
const GrenouillolandGraphique& lireGrenouillolandGraphique() const;
/**
* Accesseur.
*
* @return la valeur de @ref ligne_.
*/
const int& lireLigne() const;
/**
* Accesseur.
*
* @return la valeur de @ref colonne_.
*/
const int& lireColonne() const;
protected:
/**
* Demande à cette case graphique de se mettre à jour en fonction de l'état
* de la case correspondante du modèle.
*
* @param[in] presentateur - le présentateur à invoquer.
*/
void mettreAJour(const Presentateur& presentateur);
/**
* Callback invoqué lors d'un click de souris sur cette case graphique.
*
* @param[in] evt - l'événement associé au click.
* @return la valeur @c true.
*/
bool cbClickSouris(GdkEventButton* evt);
protected:
/**
* Représentation graphique de grenouilloland propriétaire de cette case
* graphique.
*/
GrenouillolandGraphique& grenouillolandGraphique_;
/**
* Numéro de ligne de cette cellule dans le modèle.
*/
const int ligne_;
/**
* Numéro de colonne de cette cellule dans le modèle.
*/
const int colonne_;
/**
* Pixmaps représentant tous les états possibles d'une case en fonction de leur age.
*
*/
std::map< std::string, Pointer[3] > etats_;
};
#endif
|
9b3b592bacdc9be1aeef10a971156ec625f3b3b2 | 231d0723fe7add8704ffd866178dbdd8fe50365c | /coral/tools/partitioner/partition_with_profiling.cc | d57a98b3216aefe4c7e1b7f173af0ac0b7e37589 | [
"Apache-2.0"
] | permissive | OS-Chris/libcoral | 9fc0206833de3317c4a39e8b55332f0a06005aeb | 4698784163515bc092c50bec98b200d6b3d616c8 | refs/heads/master | 2023-08-29T02:57:36.969419 | 2021-10-20T08:09:46 | 2021-10-20T08:09:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,669 | cc | partition_with_profiling.cc | /* Copyright 2019-2021 Google LLC
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 applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
// Commandline tool that partitions a cpu tflite model to segments via
// ProfilingBasedPartitioner.
#include <sys/stat.h>
#include <sys/types.h>
#include "absl/flags/flag.h"
#include "absl/flags/parse.h"
#include "absl/strings/str_join.h"
#include "absl/strings/str_split.h"
#include "coral/tools/model_pipelining_benchmark_util.h"
#include "coral/tools/partitioner/profiling_based_partitioner.h"
#include "coral/tools/partitioner/strategy.h"
#include "coral/tools/partitioner/utils.h"
#include "glog/logging.h"
ABSL_FLAG(std::string, edgetpu_compiler_binary, "",
"Path to the edgetpu compiler binary.");
ABSL_FLAG(std::string, model_path, "", "Path to the model to be partitioned.");
ABSL_FLAG(std::string, output_dir, "/tmp/models", "Output directory.");
ABSL_FLAG(int, num_segments, -1, "Number of output segment models.");
ABSL_FLAG(
EdgeTpuType, device_type, EdgeTpuType::kAny,
"Type of Edge TPU device to use, values: `pcionly`, `usbonly`, `any`.");
ABSL_FLAG(int64_t, diff_threshold_ns, 1000000,
"The target difference (in ns) between the slowest segment "
"(upper bound) and the fastest segment (lower bound).");
ABSL_FLAG(int32_t, partition_search_step, 1,
"The number of operators that are added to or removed from a segment "
"during each iteration of the partition search. "
"Default is 1.");
ABSL_FLAG(int32_t, delegate_search_step, 1,
"Step size for the delegate search when compiling the model. "
"Default is 1.");
ABSL_FLAG(int64_t, initial_lower_bound_ns, -1,
"Initial lower bound of the segment latency. "
"(Latency of the fastest segment.)");
ABSL_FLAG(int64_t, initial_upper_bound_ns, -1,
"Initial upper bound of the segment latency. "
"(Latency of the slowest segment.)");
bool FileExists(const std::string& file_name) {
struct stat info;
return stat(file_name.c_str(), &info) == 0;
}
bool CanAccess(const std::string& file_name) {
return access(file_name.c_str(), R_OK | W_OK | X_OK) == 0;
}
bool IsDir(const std::string& dir_name) {
struct stat info;
CHECK_EQ(stat(dir_name.c_str(), &info), 0) << dir_name << " does not exist";
return info.st_mode & S_IFDIR;
}
int main(int argc, char* argv[]) {
absl::ParseCommandLine(argc, argv);
const auto& edgetpu_compiler_binary =
absl::GetFlag(FLAGS_edgetpu_compiler_binary);
const auto& model_path = absl::GetFlag(FLAGS_model_path);
const auto& output_dir = absl::GetFlag(FLAGS_output_dir);
const int num_segments = absl::GetFlag(FLAGS_num_segments);
const auto& device_type = absl::GetFlag(FLAGS_device_type);
const int64_t diff_threshold_ns = absl::GetFlag(FLAGS_diff_threshold_ns);
const int partition_search_step = absl::GetFlag(FLAGS_partition_search_step);
const int delegate_search_step = absl::GetFlag(FLAGS_delegate_search_step);
const std::pair<int64_t, int64_t> initial_bounds{
absl::GetFlag(FLAGS_initial_lower_bound_ns),
absl::GetFlag(FLAGS_initial_upper_bound_ns)};
LOG_IF(FATAL, !FileExists(edgetpu_compiler_binary))
<< "edgetpu_compiler_binary " << edgetpu_compiler_binary
<< " does not exist or cannot be opened.";
LOG_IF(FATAL, !FileExists(model_path))
<< "model_path " << model_path << " does not exist or cannot be opened.";
if (!FileExists(output_dir)) {
LOG(INFO) << "output_dir " << output_dir
<< " does not exist, creating it...";
CHECK_EQ(mkdir(output_dir.c_str(), 0755), 0);
} else {
LOG_IF(FATAL, !IsDir(output_dir))
<< "output_dir " << output_dir << " is not a valid directory.";
LOG_IF(FATAL, !CanAccess(output_dir))
<< "permission denied to output_dir " << output_dir;
}
LOG_IF(FATAL, num_segments < 2) << "num_segments must be at least 2.";
LOG(INFO) << "edgetpu_compiler_binary: " << edgetpu_compiler_binary;
LOG(INFO) << "model_path: " << model_path;
LOG(INFO) << "output_dir: " << output_dir;
LOG(INFO) << "num_segments: " << num_segments;
LOG(INFO) << "device_type: " << AbslUnparseFlag(device_type);
LOG(INFO) << "diff_threshold_ns: " << diff_threshold_ns;
LOG(INFO) << "partition_search_step: " << partition_search_step;
LOG(INFO) << "delegate_search_step: " << delegate_search_step;
LOG(INFO) << "initial bounds: (" << initial_bounds.first << ", "
<< initial_bounds.second << ")";
const auto& start_time = std::chrono::steady_clock::now();
CHECK(coral::BisectPartition(edgetpu_compiler_binary, model_path, device_type,
num_segments, output_dir, diff_threshold_ns,
partition_search_step, delegate_search_step,
initial_bounds))
<< "Failed to find valid partition that meets the latency target.";
std::chrono::duration<double> time_span =
std::chrono::steady_clock::now() - start_time;
LOG(INFO) << "Segments have been saved under " << output_dir;
LOG(INFO) << "Total time: " << time_span.count() << "s.";
return 0;
}
|
4a6210618124e71f17265b701854446ece66ddb0 | 67bcd071970105ed8cede9f84847859da55852fe | /2. C++/Tarea/Fracciones/FraccionTest.cpp | 56463925a7676079bdf78a43031ee2c07af9657a | [] | no_license | Tapia641/escom-sistemas-distribuidos | 982fae164b2d4f72947a035c3f9d51fddbdfea16 | 8947e91a18a977ca45696b683a3733b25bd12cc3 | refs/heads/master | 2022-09-16T17:27:18.875013 | 2019-11-15T05:12:06 | 2019-11-15T05:12:06 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 284 | cpp | FraccionTest.cpp | #include <iostream>
#include "Fraccion.h"
using namespace std;
int main() {
Fraccion t(1, 9);
cout<<"Fracción: ";
t.imprime();
std::cout << endl;
cout<<"División: ";
std::cout << t.getDouble() << endl;
cout<<"Mínima Expresión: ";
t.imprimeMinima();
std::cout << endl;
}
|
072946b8b4fa5a4007bffbe0698f255c71509890 | d1ca9f9fbb1817a80e9051a5ab2b2a31efb1bb07 | /source/core/TraitSet.hpp | cf98f6325b36aba1a97a02e29145004f4bc03117 | [
"MIT"
] | permissive | mercere99/MABE2 | dbdf3fdd208b752149cf2bf1f083155b001de79c | 7eba5d316604815a35d1c3bd0e69dde594e77634 | refs/heads/master | 2023-09-03T22:23:56.594269 | 2023-08-29T22:22:24 | 2023-08-29T22:22:24 | 189,902,530 | 5 | 18 | MIT | 2022-07-19T19:26:17 | 2019-06-02T22:44:11 | C++ | UTF-8 | C++ | false | false | 8,339 | hpp | TraitSet.hpp | /**
* @note This file is part of MABE, https://github.com/mercere99/MABE2
* @copyright Copyright (C) Michigan State University, MIT Software license; see doc/LICENSE.md
* @date 2021.
*
* @file TraitSet.hpp
* @brief A collection of traits with the same type (or collections of that type).
*
* A TraitSet is used to keep track of a collection of related traits in a module.
*
* For example, this class is used inside of Lexicase selection to track the group of
* traits under consideration during optimization.
*
* @CAO: Should this class be moved into Empirical proper?
*/
#ifndef MABE_TRAIT_SET_H
#define MABE_TRAIT_SET_H
#include <string>
#include "emp/base/vector.hpp"
#include "emp/data/DataMap.hpp"
#include "emp/meta/TypeID.hpp"
#include "emp/tools/string_utils.hpp"
#include "emp/datastructs/vector_utils.hpp"
namespace mabe {
template <typename T>
class TraitSet {
private:
// Each entry in a trait set can be a single trait (BASE), a series of sequential traits
// (MULTI), or an emp::vector of the trait type (VECTOR)
enum TraitType { BASE=0, MULTI=1, VECTOR=2 };
// When tracking a trait, we care about its type (see previous), where it is in the layout (id)
// how many trait values we are talking about (count), and how many total values are up to
// this point (cum_count) to facilitate searches.
struct TraitData {
TraitType type;
size_t id;
size_t count;
size_t cum_count=0; // How many total sites used until the end of this one?
TraitData(TraitType _t=BASE, size_t _id=0, size_t _c=1) : type(_t), id(_id), count(_c) { }
};
emp::vector<std::string> trait_names;
emp::vector<TraitData> trait_data;
emp::Ptr<const emp::DataLayout> layout; // Layout for the DataMaps that we will access.
size_t num_values = 0;
std::string error_trait = "";
public:
TraitSet() : layout(nullptr) { }
TraitSet(const emp::DataLayout & in_layout) : layout(&in_layout) { }
~TraitSet() = default;
emp::vector<std::string> GetNames() const { return trait_names; }
const emp::DataLayout & GetLayout() const { return *layout; }
void SetLayout(const emp::DataLayout & in_layout) { layout = &in_layout; }
void Clear() {
trait_names.resize(0);
trait_data.resize(0);
num_values = 0;
}
/// Add a single trait.
bool AddTrait(const std::string & name) {
if (!layout->HasName(name)) {
error_trait = name;
return false;
}
trait_names.push_back(name);
const size_t id = layout->GetID(name);
const size_t count = layout->GetCount(id);
if (layout->IsType<T>(id)) {
if (count == 1) trait_data.emplace_back(TraitType::BASE, id, 1);
else trait_data.emplace_back(TraitType::MULTI, id, count);
}
else if (layout->IsType<emp::vector<T>>(id) && count == 1) {
trait_data.emplace_back(TraitType::VECTOR, id, 1);
}
else {
error_trait = name;
return false;
}
return true;
}
/// Add any number of traits, separated by commas.
bool AddTraits(const std::string & in_names) {
emp_assert(!layout.IsNull());
auto names = emp::slice(in_names, ',');
for (const std::string & name : names) {
if (AddTrait(name) == false) return false;
}
return true;
}
/// Add groups of traits; each string can have multiple trait names separated by commas.
template <typename... Ts>
bool AddTraits(const std::string & in_names, const std::string & next_names, Ts &... extras) {
return AddTraits(in_names) && AddTraits(next_names, extras...);
}
/// Clear any existing traits and load in the ones provided.
template <typename... Ts>
bool SetTraits(Ts &... traits) {
Clear();
return AddTraits(traits...);
}
/// Get the total number of traits being monitored (regular values + vectors of values)
size_t GetNumTraits() const {
return trait_data.size();
}
/// Count the total number of individual values across all traits and store for future use.
size_t CountValues(const emp::DataMap & dmap) {
emp_assert(!layout.IsNull());
emp_assert(dmap.HasLayout(*layout), "Attempting CountValues() on DataMap with wrong layout");
num_values = 0;
for (TraitData & data : trait_data) {
switch (data.type) {
case TraitType::BASE: ++num_values; break;
case TraitType::MULTI: num_values += data.count; break;
case TraitType::VECTOR:
data.count = dmap.Get<emp::vector<T>>(data.id).size();
num_values += data.count;
}
data.cum_count = num_values;
}
return num_values;
}
/// Get last calculated count of values; set to zero if count not up to date.
size_t GetNumValues() const { return num_values; }
/// Get all associated values out of a data map and place them into a provided vector.
void GetValues(const emp::DataMap & dmap, emp::vector<T> & out) {
emp_assert(!layout.IsNull());
// Make sure we have the right amount of room for the values.
out.resize(0);
out.reserve(GetNumValues());
// Loop through collecting values.
for (TraitData & data : trait_data) {
switch (data.type) {
case TraitType::BASE:
out.push_back( dmap.Get<T>(data.id) );
break;
case TraitType::MULTI: {
std::span<const T> cur_span = dmap.Get<T>(data.id, data.count);
out.insert(out.end(), cur_span.begin(), cur_span.end());
} break;
case TraitType::VECTOR: {
const emp::vector<T> & cur_vec = dmap.Get<emp::vector<T>>(data.id);
out.insert(out.end(), cur_vec.begin(), cur_vec.end());
} break;
}
}
}
/// Copy associated values from data map to a provided vector, only for positions specified;
/// all other positions are 0.0.
void GetValues(const emp::DataMap & dmap,
emp::vector<T> & out,
const emp::vector<size_t> & ids_used) {
emp_assert(!layout.IsNull());
emp_assert(std::is_sorted(ids_used.begin(), ids_used.end())); // Requested values should be in sorted order.
// Make sure we have the right amount of room for the values, with non-used ones set to zero.
out.resize(0);
out.resize(GetNumValues(), 0.0);
size_t trait_id = 0;
size_t offset = 0;
for (const size_t id : ids_used) {
while (id >= trait_data[trait_id].cum_count) {
offset = trait_data[trait_id].cum_count;
++trait_id;
emp_assert(trait_id < trait_data.size(),
"PROBLEM! TraitSet ran out of vectors without finding trait id.");
}
switch (trait_data[trait_id].type) {
case TraitType::BASE:
emp_assert(id == offset, id, offset);
out[id] = dmap.Get<T>(trait_id);
break;
case TraitType::MULTI: {
std::span<const T> cur_span = dmap.Get<T>(trait_id, trait_data[trait_id].count);
out[id] = cur_span[id-offset];
} break;
case TraitType::VECTOR: {
const emp::vector<T> & cur_vec = dmap.Get<emp::vector<T>>(trait_id);
out[id] = cur_vec[id-offset];
} break;
}
}
}
/// Get a value at the specified index of this map.
// @TODO: This could be sped up using binary search.
T GetIndex(const emp::DataMap & dmap, size_t value_index) const {
emp_assert(value_index < num_values, value_index, num_values);
size_t trait_id = 0;
while (value_index >= trait_data[trait_id].cum_count) ++trait_id;
const size_t offset = (trait_id==0) ? 0 : trait_data[trait_id-1].cum_count;
const TraitData & data = trait_data[trait_id];
switch (data.type) {
case TraitType::BASE: return dmap.Get<T>(data.id);
case TraitType::MULTI: return dmap.Get<T>(data.id, data.count)[value_index - offset];
case TraitType::VECTOR: return dmap.Get<emp::vector<T>>(data.id)[value_index - offset];
}
return T{};
}
void PrintDebug() const {
std::cout << "Trait names: " << emp::ToString(trait_names) << std::endl;
}
};
}
#endif
|
663a19f1906e908cba25eb3ff94513abfea0f08f | 8f6be521c2becab9ffc579b0bae57066b045b371 | /include/Game.h | 49512e2ffcfad24d1c279040ed9099d63427494a | [
"LicenseRef-scancode-public-domain"
] | permissive | yurivanmidden/mod11-pacman | 6dadde739bb22b9885e3f721bac4870460cd6be0 | 6401428ebe587637873efe048f97f07890041631 | refs/heads/master | 2021-09-11T09:47:02.034091 | 2018-03-20T10:44:29 | 2018-03-20T10:44:29 | 125,997,109 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 727 | h | Game.h | //
// Created by yuri on 20-3-18.
//
#ifndef PACMAN_GAME_H
#define PACMAN_GAME_H
#include <vector>
#include "GameObjectStruct.h"
#include "Character.h"
class Game {
private:
int score;
int lives;
public:
Game() : score(0), lives(3) {
}
void init() {
}
// TODO: This convention is not right
std::vector<GameObjectStruct> getStructs() {
Character pacman(PACMAN);
return {pacman.getStruct()};
}
int getScore() const {
return score;
}
void setScore(int score) {
Game::score = score;
}
int getLives() const {
return lives;
}
void setLives(int lives) {
Game::lives = lives;
}
};
#endif //PACMAN_GAME_H
|
4ed4337712e6dd2b28ef59a91f5dfe1c0168c412 | a187e3ce8243a76617e10827692241868af263ec | /wallet/bfxt/bfxtoutpoint.cpp | 5bbea51bb239cf1f97c1490eba32a3c2f95d0570 | [
"MIT"
] | permissive | sanjayg99/bfx | 6b1b5a9f80c27e1daa7a5089db2eefa8ce386b1a | 62494103b9934e41830152af90abe85cf0250eeb | refs/heads/master | 2022-09-01T10:04:57.087252 | 2020-05-23T17:51:12 | 2020-05-23T17:51:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,048 | cpp | bfxtoutpoint.cpp | #include "bfxtoutpoint.h"
#include "bfxttools.h"
BFXTOutPoint::BFXTOutPoint() { setNull(); }
BFXTOutPoint::BFXTOutPoint(const uint256& hashIn, unsigned int indexIn)
{
hash = hashIn;
index = indexIn;
hashStr = hashIn.ToString();
}
void BFXTOutPoint::setNull()
{
hash = 0;
index = (unsigned int)-1;
hashStr = "";
}
bool BFXTOutPoint::isNull() const { return (hash == 0 && index == (unsigned int)-1); }
uint256 BFXTOutPoint::getHash() const { return hash; }
unsigned int BFXTOutPoint::getIndex() const { return index; }
json_spirit::Value BFXTOutPoint::exportDatabaseJsonData() const
{
json_spirit::Object root;
root.push_back(json_spirit::Pair("hash", hash.ToString()));
root.push_back(json_spirit::Pair("index", uint64_t(index)));
return json_spirit::Value(root);
}
void BFXTOutPoint::importDatabaseJsonData(const json_spirit::Value& data)
{
setNull();
index = BFXTTools::GetUint64Field(data.get_obj(), "index");
hash.SetHex(BFXTTools::GetStrField(data.get_obj(), "hash"));
}
|
0ea09825b31004f0caef1183ea3b9c0fa6886c0f | 404ecc8fcf7c80d89c3e8c23278656f239c2eb6a | /probability/notification_policy.h | f96270f26c7ba9ad9b4dcaa914becde64eb7adf9 | [
"MIT"
] | permissive | petermchale/mutation_accumulation | 4c6bfbe3138e0bdbe0057c6d830e5fbb37baebc9 | f4bd9182619bae1b2e8fa95700540ee398c2bdd6 | refs/heads/master | 2020-04-09T07:01:30.480479 | 2017-09-21T18:59:26 | 2017-09-21T18:59:26 | 68,173,189 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,484 | h | notification_policy.h | #ifndef NOTIFICATION_POLICY_H
#define NOTIFICATION_POLICY_H
#include <cassert> // assert
#include <mutation_accumulation/utility/data_traits.h> // data_types::discrete_type, etc
#include <mutation_accumulation/configuration/utilities/lifetime_risk.h> // time_greater_than_zero
/*************************************************************************/
namespace probability {
/**
* rules dictating when probability subjects should notify observers\n
* using independent classes rather than a hierarchy of classes because I want to invoke without instantiation
*/
namespace notify_detail {
/**
* implementation of Notify_Range::notify(..) for discrete sample type
*/
template <class sample_type>
const bool do_range_notify(
const sample_type &sample,
const std::vector<sample_type> &sample_space,
data_types::discrete_type) {
const bool cond1 = sample >= sample_space.front();
const bool cond2 = sample <= sample_space.back();
return (cond1 && cond2);
}
/**
* implementation of Notify_Range::notify(..) for continuous sample type
*/
template <class sample_type>
const bool do_range_notify(
const sample_type &sample,
const std::vector<sample_type> &sample_space,
data_types::continuous_type) {
const bool cond1 = sample > sample_space.front() - 1e-8; // insures that sample = sample_space.front() returns true, eg. sample = 0
const bool cond2 = sample < sample_space.back();
return (cond1 && cond2);
}
}
/**
* notify observers if sample lies anywhere in given range \n
*/
template <class sample_type>
class Notify_Range {
public:
typedef sample_type sample_t;
static const bool notify(const sample_type &sample, const std::vector<sample_type> &sample_space) {
typename data_types::data_traits<sample_type>::category sample_category;
notify_detail::do_range_notify(sample, sample_space, sample_category);
}
};
/**
* notify observers if sample is true
*/
class Notify_True {
public:
typedef bool sample_t;
static const bool notify(const sample_t &sample, const std::vector<sample_t> &sample_space) {
/* check that sample space is (0,1) */
assert(sample_space.size() == 2);
assert(sample_space.at(0) == false);
assert(sample_space.at(1) == true);
return (sample == true);
}
};
/**
* notify observers if sample is non-negative and no larger than upper limit of sample space \n
*/
template <class sample_type>
class Notify_NonNegative_BoundedAbove {
public:
typedef sample_type sample_t;
static const bool notify(const sample_type &sample, const std::vector<sample_type> &sample_space) {
typename data_types::data_traits<sample_type>::category sample_category;
const bool cond_lower = monte_carlo::mutation_occurred_within_timeSpan_detail::time_greater_than_zero(sample, sample_category);
const bool cond_upper = monte_carlo::mutation_occurred_within_timeSpan_detail::time_less_than_LL(sample, sample_space.back(), sample_category);
return cond_lower && cond_upper;
}
};
}
#endif /* NOTIFICATION_POLICY_H */
|
c9025f4342676a68f5f479c2e7ab5fa3f300a718 | ab9ea4f4c42206c5effd650eafd04703f1a07b71 | /CS-445 Computer Graphics/Lab 1/Part 1/GeometricObject.h | e23af4bd8e1e82f97dc08c6aab9a3610de0b3d8f | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | djaffalikhaled/WillametteUniversity | dc8eead601a03169bde13355dc1f1244440d1f38 | e4407077fe2708cd3e46835e01a33e94b9e22964 | refs/heads/master | 2021-05-28T15:37:24.350120 | 2014-11-04T21:25:02 | 2014-11-04T21:25:02 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,015 | h | GeometricObject.h | // GeometricObhect.h
// Modified from
// Copyright (C) Kevin Suffern 2000-2007. Modified by G. Orr
#ifndef __GEOMETRIC_OBJECT__
#define __GEOMETRIC_OBJECT__
#include <math.h>
#include "Constants.h"
#include "RGBColor.h"
#include "Vector3D.h"
#include "Ray.h"
#include "ShadeRec.h"
#include "Material.h"
class Material;
//----------------------------------------------------------------------------------------------------- class GeometricObject
class GeometricObject {
public:
GeometricObject(void);
GeometricObject(const GeometricObject& object);
virtual GeometricObject* clone(void) const = 0;
virtual ~GeometricObject(void);
virtual ShadeRec hit(const Ray& ray) const = 0;
virtual void set_material(Material* mPtr);
Material* get_material(void) const;
public:
Material* material_ptr;
GeometricObject& operator= (const GeometricObject& rhs);
RGBColor color; // only used before Materials and Lights are implemented
};
#endif
|
18859cbfe813eb16707e63818ac4cf54e1ba8c16 | 75ffa6ffb76fc351380f639932a348c8dfc22a9c | /lab3/lab3.cpp | 9673e00d542cba80a7522b920bf33c86463219bd | [] | no_license | skyisperfect/effectiveprogrammingcpp | 802f0c7123286af591641dd68ef5670e550addb7 | 1948b439502d9023a72ecf913ad0981c5fbd4265 | refs/heads/master | 2020-03-08T04:37:10.851800 | 2018-06-18T14:45:03 | 2018-06-18T14:45:03 | 127,927,305 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,189 | cpp | lab3.cpp | #include <iostream>
#include <fstream>
#include <cassert>
using namespace std;
template <class TYPE>
class Matrix{
private:
TYPE **arr;
int rows;
int columns;
public:
Matrix(){}
Matrix(int row, int cols): rows(row), columns(cols){
arr = new TYPE*[row];
for(int i = 0; i < row; i++){
arr[i] = new TYPE[cols]{};
}
}
~Matrix(){}
void Read(string filename){
ifstream file(filename);
if (!file.is_open()){
cout << "ERROR";
}else{
file >> rows >> columns;
arr = new TYPE*[rows];
for(int i = 0; i < rows; i++){
arr[i] = new TYPE[columns];
}
for(int i = 0; i < rows; i++){
for(int j = 0; j < columns; j++){
file >> arr[i][j];
}
}
}
file.close();
}
void Print(){
for(int i = 0; i < rows; i++){
for(int j = 0; j < columns; j++){
cout << arr[i][j] << " ";
}
cout<<endl;
}
}
Matrix operator+(Matrix &sF)const {
assert(rows == sF.rows && columns == sF.columns);
Matrix result(sF.rows, sF.columns);
for(int i = 0; i < rows; i++){
for(int j = 0; j < columns; j++){
result.arr[i][j] = arr[i][j] + sF.arr[i][j];
}
}
return result;
}
Matrix operator-(Matrix &sF)const {
assert(rows == sF.rows && columns == sF.columns);
Matrix result(sF.rows, sF.columns);
for(int i = 0; i < rows; i++){
for(int j = 0; j < columns; j++){
result.arr[i][j] = arr[i][j] - sF.arr[i][j];
}
}
return result;
}
Matrix operator*(Matrix &sF)const {
assert(columns == sF.rows);
Matrix result(rows, sF.columns);
for(int i = 0; i < rows; i++){
for(int j = 0; j < sF.columns; j++){
int tmp = 0;
for(int t = 0; t < columns; t++){
tmp += arr[i][t]*sF.arr[t][j];
}
result.arr[i][j] = tmp;
}
}
return result;
}
Matrix Transp()const {
Matrix result(columns, rows);
for (int i = 0; i < rows; i++){
for( int j = 0; j < columns; j++){
result.arr[j][i] = arr[i][j];
}
}
return result;
}
};
int main() {
string A = "matrix1.txt";
string B = "matrix2.txt";
Matrix<int> matrix1;
Matrix<int> matrix2;
Matrix<int> matrix3;
Matrix<int> matrix4;
Matrix<int> matrix5;
cout << "Matrix A:" << endl;
matrix1.Read(A);
matrix1.Print();
cout << "\nMatrix B:" << endl;
matrix2.Read(B);
matrix2.Print();
cout << "\nMatrix A + Matrix B:" << endl;
matrix3 = matrix1 + matrix2;
matrix3.Print();
cout << "\nMatrix A - Matrix B:" << endl;
matrix4 = matrix1 - matrix2;
matrix4.Print();
cout << "\nMatrix A * Matrix B:" << endl;
matrix5 = matrix1 * matrix2;
matrix5.Print();
return 0;
}
|
bdae3a882c0aacafa39302cd3cd66b80593b70ed | f3efc46550fb3c28961eb0caf34074680f55f8dc | /CodeChef/POLYEVAL.cpp | 8034dcb147784f18716b67ba7e9c3b7ba640760b | [] | no_license | QMrpy/competitive-programming | ec3905a33227b4fe89c728a92540f888642e1331 | 2a291aaf2fc7e91d604d7d790669b3e4c34755b6 | refs/heads/master | 2020-04-25T18:03:09.260122 | 2019-01-19T09:42:01 | 2019-01-19T09:42:01 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,257 | cpp | POLYEVAL.cpp |
// Evaluate the polynomial
// https://www.codechef.com/problems/POLYEVAL
// Number theoretic transform
// O(N log N)
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 786433;
const int MAX_N = 8e5 + 5;
namespace NTT {
const long long P = MOD; // P = 2 ^ 18 * 3 + 1
const int K = 18;
const int ROOT = 10;
const int N = 1 << K;
vector<int> W;
vector<int> rev;
void init() {
W.resize(N); W[0] = 1;
W[1] = ROOT * ROOT * ROOT;
for (int i = 2; i < N; i++)
W[i] = 1LL * W[i - 1] * W[1] % P;
rev.resize(N); rev[0] = 0;
for (int i = 1; i < N; i++)
rev[i] = rev[i >> 1] >> 1 | ((i & 1) << (K - 1));
}
void transform(vector<int> &a) {
for (int i = 1; i < N; i++) if (i < rev[i])
swap(a[i], a[rev[i]]);
for (int len = 2; len <= N; len <<= 1) {
int half = len >> 1, diff = N / len;
for (int i = 0; i < N; i += len) {
int pw = 0;
for (int j = i; j < i + half; j++) {
int v = 1LL * a[j + half] * W[pw] % P;
a[j + half] = a[j] - v;
if (a[j + half] < 0) a[j + half] += P;
a[j] += v;
if (a[j] >= P) a[j] -= P;
pw += diff;
}
}
}
}
};
int N, Q, A[MAX_N], ans[MAX_N];
void solve() {
NTT::init();
vector<int> a0(A, A + N + 1), a1(NTT::N), a2(NTT::N); a0.resize(NTT::N);
long long shift = 1;
for (int i = 0; i <= N; i++) {
a1[i] = a0[i] * shift % MOD;
a2[i] = a1[i] * shift % MOD;
shift = shift * NTT::ROOT % MOD;
}
NTT::transform(a0);
NTT::transform(a1);
NTT::transform(a2);
ans[0] = A[0];
for (int i = 0; i < NTT::N; i++) {
long long x = NTT::W[i]; ans[x] = a0[i];
x = x * NTT::ROOT % MOD; ans[x] = a1[i];
x = x * NTT::ROOT % MOD; ans[x] = a2[i];
}
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
cin >> N;
for (int i = 0; i <= N; i++)
cin >> A[i];
solve();
cin >> Q;
while (Q--) {
int x; cin >> x;
cout << ans[x] << "\n";
}
return 0;
} |
fde1e6883509f7b5a4bf80cd65c184bca0eacd5b | 8d067e70466c2c9b301d3c47b3e93ed38bf8f82a | /V3/src/model.h | 9a13b99ca04149fbd713b1809d911cdeefae3717 | [] | no_license | robertbrignull/StudyAid | 349d8565166fee19a67041cfaf5270bf9a8df52a | a71ecf55433b53ae9ea5065eb1e4710470d5be29 | refs/heads/master | 2016-09-06T08:05:05.784051 | 2014-04-23T21:50:08 | 2014-04-23T21:50:08 | 13,322,199 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,579 | h | model.h | #pragma once
#include <QObject>
#include "database/structures.h"
class ModelSignaller : public QObject
{
Q_OBJECT
signals:
void courseAdded(Course course);
void courseEdited(Course course);
void courseOrderingEdited(Course course);
void courseDeleted(int id);
void factAdded(Fact fact);
void factEdited(Fact fact);
void factOrderingEdited(Fact fact);
void factDeleted(int id);
void proofAdded(Proof proof);
void proofEdited(Proof proof);
void proofOrderingEdited(Proof proof);
void proofDeleted(int id);
public slots:
void addCourse(Course course);
void editCourse(Course course);
void editCourseOrdering(Course course);
void deleteCourse(int id);
void addFact(Fact fact);
void editFact(Fact fact);
void editFactOrdering(Fact fact);
void deleteFact(int id);
void addProof(Proof proof);
void editProof(Proof proof);
void editProofOrdering(Proof proof);
void deleteProof(int id);
};
class Model : public QObject
{
Q_OBJECT
public:
Model(ModelSignaller *modelSignaller);
ModelSignaller *getModelSignaller();
bool isCourseSelected();
Course getCourseSelected();
bool isFactSelected();
Fact getFactSelected();
bool isProofSelected();
Proof getProofSelected();
signals:
void courseSelectedChanged(Course course);
void courseAdded(Course course);
void courseEdited(Course course);
void courseOrderingEdited(Course course);
void courseDeleted(int id);
void factSelectedChanged(Fact fact);
void factAdded(Fact fact);
void factEdited(Fact fact);
void factOrderingEdited(Fact fact);
void factDeleted(int id);
void proofSelectedChanged(Proof proof);
void proofAdded(Proof proof);
void proofEdited(Proof proof);
void proofOrderingEdited(Proof proof);
void proofDeleted(int id);
public slots:
void setCourseSelected(Course course);
void addCourse(Course course);
void editCourse(Course course);
void editCourseOrdering(Course course);
void deleteCourse(int id);
void setFactSelected(Fact fact);
void addFact(Fact fact);
void editFact(Fact fact);
void editFactOrdering(Fact fact);
void deleteFact(int id);
void setProofSelected(Proof proof);
void addProof(Proof proof);
void editProof(Proof proof);
void editProofOrdering(Proof proof);
void deleteProof(int id);
private:
ModelSignaller *modelSignaller;
bool courseSelected, factSelected, proofSelected;
Course course;
Fact fact;
Proof proof;
}; |
46f5fb9a99a859484e2f5ceebad0ef70ffc5cb97 | 310b32b04946f0ee3e131cf33fef635696c1ff4a | /src/signAChart/SAAbstractPlotEditor.cpp | 0d88e25f858dd847b255f75b49593d7f589c5006 | [] | no_license | stlcours/sa | 5d99423a13e471080ef7e3943b456efb61a8ba75 | 826c7f827567fc5021c968e7b541a287e8e3e759 | refs/heads/master | 2021-05-16T04:17:46.005741 | 2017-09-21T06:00:14 | 2017-09-21T06:00:14 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 990 | cpp | SAAbstractPlotEditor.cpp | #include "SAAbstractPlotEditor.h"
SAAbstractPlotEditor::SAAbstractPlotEditor(QwtPlot *parent)
:QObject(parent)
,m_isEnable(false)
{
}
SAAbstractPlotEditor::~SAAbstractPlotEditor()
{
}
const QwtPlot *SAAbstractPlotEditor::plot() const
{
return qobject_cast<const QwtPlot *>( parent() );
}
QwtPlot *SAAbstractPlotEditor::plot()
{
return qobject_cast<QwtPlot *>( parent() );
}
void SAAbstractPlotEditor::setEnabled(bool on)
{
if ( on == m_isEnable )
return;
QwtPlot *plot = qobject_cast<QwtPlot *>( parent() );
if ( plot )
{
m_isEnable = on;
if(plot->canvas())
{
if ( on )
{
plot->canvas()->installEventFilter( this );
}
else
{
plot->canvas()->removeEventFilter( this );
}
}
}
}
bool SAAbstractPlotEditor::isEnabled() const
{
return m_isEnable;
}
|
70ac1dfe59facb0f71092ade4708885e5202dfb0 | ae571e01b5fb10cd98dc6b79472170c0f567e6b9 | /include/Inventory/GearSlots.h | 639be04471614c51494ed8a8befcb8f3719a53f9 | [] | no_license | Oscillation/oscMrk-II | 9cda29f66db59148e0bfbb1ba640665ba423bda2 | 34833b85a42cf12514095d3a28ac3b3627fd712a | refs/heads/master | 2021-01-23T04:09:27.631400 | 2014-03-03T06:34:41 | 2014-03-03T06:34:41 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 384 | h | GearSlots.h | #pragma once
#include "Inventory\Inventory.h"
#include "Inventory\GearSlot.h"
class GearSlots : public Inventory{
public:
GearSlots::GearSlots(TextureHolder const& textures, int invWidth, int x_offset, int y_offset);
std::vector<GearSlot> slots;
void GearSlots::Command(GearSlot* slot, Inventory* inventory);
void draw(sf::RenderTarget & target, sf::RenderStates states)const;
}; |
191f02a1ca87da7522334d9af20d14f63bcacea3 | 79e4954c366dbf4b119d9b38cafe0c24f08adfcd | /Dynamic Programming/palindrompartitioning.cpp | 25a64fd04592f4a16186fa0ece5b1a86a4368c08 | [] | no_license | prashantmarshal/ds-codes | 463e67f077544386d4484c472fd3defa9d0acfb5 | 184421907a97330e20c45454cb956d15086e84e3 | refs/heads/master | 2021-01-10T05:18:26.506471 | 2015-10-24T19:29:29 | 2015-10-24T19:29:29 | 44,881,110 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 787 | cpp | palindrompartitioning.cpp | /*palindrome min cuts*/
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
int mincutspalindrome(string str){
int len = str.length();
bool p[len][len];
int c[len][len];
memset(p,0,len*len*sizeof(bool));
memset(c,0,len*len*sizeof(int));
for(int i = 0; i < len; ++i)
p[i][i] = 1;
for(int l = 2; l <= len; ++l){
for(int i = 0; i < len-l+1; ++i){
int j = i+l-1;
if(l == 2){
p[i][j] = (str[i]==str[j]);
else
p[i][j] = (str[i]==str[j] && p[i+1][j-1]==true);
if(p[i][j])
c[i][j] = 0;
else{
int k = i;
c[i][j] = 10000;
for(;k<j;++k){
c[i][j] = min(c[i][j], c[i][k]+1+c[k+1][j]);
}
}
}
}
return c[0][len-1];
}
int main()
{
char str[] = "ababbbabbababa";
cout<<mincutspalindrome(str);
} |
e01cb064d0ea9dbbb176c54602af1c1322e00dc6 | 0b658fcf4d0cf12fcbf9883642916d85b2c80be6 | /lib/themes/default/default.h | 030bfee804b66749c923644de8c16d6ae5c06ab3 | [] | no_license | EasyDevCpp/FoxyGui | 3f2237af4753d888ac28115a5a675024be4c541c | e161a3a54cd1fafd005c034570eead14d0e9521e | refs/heads/master | 2020-03-22T12:19:38.556666 | 2018-07-10T17:48:15 | 2018-07-10T17:48:15 | 140,033,137 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 641 | h | default.h | #ifndef __DEFAULT_THEME
#define __DEFAULT_THEME
namespace default_res {
}
/*
* Window Controls
*/
void CloseButton::fadeIn() {
}
void CloseButton::fadeOut() {
}
void CloseButton::draw() {
SDLExt_DrawRect((*getContainer())->getRenderer(),getX(),getY(),getWidth(),getHeight(),{255,0,0});
}
void MaximizeButton::fadeIn() {
}
void MaximizeButton::fadeOut() {
}
void MaximizeButton::draw() {
}
void MinimizeButton::fadeIn() {
}
void MinimizeButton::fadeOut() {
}
void MinimizeButton::draw() {
}
void WindowButtons::fadeIn() {
}
void WindowButtons::fadeOut() {
}
void WindowButtons::draw() {
(*close_btn)->draw();
}
#endif
|
20248635a7c11349dd6d403ca7b006a3661dbd79 | 7f14a0ed30774b984daf7498d1d7dc1c4e7693a0 | /src/server/CommandsDiodColor.cpp | 851be78fc3bc1cbf032b16ca2cdec8935577eace | [] | no_license | evgeny-bunya/camera-control | 3c36151dc6e8168c9fead5341aaf22d916286ec1 | 60f23dcf60875dc7eedac952d19e3144bbc29405 | refs/heads/master | 2022-06-13T09:07:03.281141 | 2020-05-04T12:30:32 | 2020-05-04T12:32:32 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,246 | cpp | CommandsDiodColor.cpp | #include "CommandsDiodColor.h"
#include "DiodColor.h"
// класс команды включения-выключения диода
SetDiodColorCommand::SetDiodColorCommand(DiodColor& colorRef):
ICommand(),
color(colorRef)
{
}
SetDiodColorCommand::~SetDiodColorCommand()
{
}
std::string SetDiodColorCommand::getName()
{
return "set-led-color";
}
std::string SetDiodColorCommand::execute(const std::string& arg)
{
if (arg.compare("red") == 0)
{
color.setValue(DiodPalette::RED);
return "OK";
}
else if (arg.compare("green") == 0)
{
color.setValue(DiodPalette::GREEN);
return "OK";
}
else if (arg.compare("blue") == 0)
{
color.setValue(DiodPalette::BLUE);
return "OK";
}
else
{
return "FAILED";
}
}
// класс команды включения-выключения диода
GetDiodColorCommand::GetDiodColorCommand(const DiodColor& colorRef):
ICommand(),
color(colorRef)
{
}
GetDiodColorCommand::~GetDiodColorCommand()
{
}
std::string GetDiodColorCommand::getName()
{
return "get-led-color";
}
std::string GetDiodColorCommand::execute(const std::string& arg)
{
return ("OK " + this->color.getValueString());
}
|
ae9756c9a9921fdcb84a7e027ff6f52cf16f75b4 | e7594dd55dcbf2e54cc14491e554611fb3f96fec | /labo/clase_07/L07/CLion/L07-MatricesYTableros/test/ej03Test.cpp | de9ab67769df2c2be844909eb75f4793beb12d52 | [] | no_license | NicoKc/algo1 | 5b66bdb8009752cf5ba16c84a1812ae8de767083 | 57a34a225d299e1d7eb4e4d457c0740f35b04242 | refs/heads/master | 2022-11-29T23:26:57.334479 | 2020-08-17T16:18:13 | 2020-08-17T16:18:13 | 256,615,834 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 342 | cpp | ej03Test.cpp | #include "../lib/gtest.h"
#include "../src/ej03.h"
TEST(redimensionarTest, caso1) {
matriz a{{1, 2, 3, 4},
{5, 6, 7, 8},
{9, 10, 11, 12}};
matriz esperada{{1, 2, 3, 4, 5, 6},
{7, 8, 9, 10, 11, 12}};
matriz aPrima = redimensionar(a, 6, 2);
ASSERT_EQ(aPrima, esperada);
}
|
fef5e31afb8bf6a3b3fcfe11f17779fb03b8f384 | 934c51e15d3ca39aef0c02e9276a0a9b8346d639 | /Lab9.3/Lab9.3.cpp | 9359d6a6912d047199a71988d8f04b47cf41469e | [] | no_license | Feynom/lab9.3 | 2e4a4d013cfa48f45d6706ea9b4dd3f765938cf8 | 0b1a4e17b953aaa33742e64ebb2192306709365d | refs/heads/main | 2023-01-23T07:31:48.142906 | 2020-12-04T19:52:55 | 2020-12-04T19:52:55 | 318,198,901 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,460 | cpp | Lab9.3.cpp | #include <iostream>
#include <string>
#include <iomanip>
#include <Windows.h>
#include <fstream>
using namespace std;
#pragma pack(push, 1)
struct Shop
{
string shop_name;
string item_name;
double price_for_item; //у гривня
int amount_of_items; //наприклад 100 штук
};
#pragma pack(pop)
void Create(Shop* S, int N_start, const int N);
void Print(Shop* S, const int N);
void SaveToFile(Shop* S, const int N, const char* filenЬщame);
void LoadFromFile(Shop*& S, int& N, const char* filename);
void Sort(Shop* S, const int N, int SortType);
void Modify_string(Shop* S, const int N, int what_modify, string modify_to_string, int row);
void Modify_int(Shop* S, const int N, int what_modify, int modify_to_int, int row);
void print_info_item(Shop* S, const int N, string item_name);
void print_info_shop(Shop* S, const int N, string shop_name);
void push_back(Shop*& S, int N);
void del(Shop*& S, int N, int row_del);
int main()
{
SetConsoleCP(1251);
SetConsoleOutputCP(1251);
int N;
do
{
cout << "Введіть кількість товарів: ";
cin >> N;
} while (N < 1);
Shop* S = new Shop[N];
int action;
int SortType;
int row_del;
unsigned what_modify;
string modify_to_string;
int modify_to_int;
int what_to_do;
int row;
int add;
int action_case_5;
string item_name, shop_name;
char filename[100];
do
{
cout << endl
<< endl;
cout << "Виберіть дію: " << endl;
cout << "1 - Введення даних з клавіатури" << endl;
cout << "2 - Виведення інформації на екран" << endl;
cout << "3 - Запис інформації у файл" << endl;
cout << "4 - Зчитування даних із файлу" << endl;
cout << "5 - Корегування списку з клавіатури" << endl;
cout << "6 - Відсортувати список за назвою товару або за назвою магазину" << endl;
cout << "7 - Пошук товару за його назвою" << endl;
cout << "8 - Пошук товарів, які продаються в магазині" << endl;
cout << "0 - Завершити роботу програми" << endl;
cout << "Введіть: ";
cin >> action;
cout << endl
<< endl;
switch (action)
{
case 1:
Create(S, 0, N);
break;
case 2:
Print(S, N);
break;
case 3:
cin.get();
cin.sync();
cout << "Введіть назву файлу: ";
cin.getline(filename, 99);
SaveToFile(S, N, filename);
break;
case 4:
cin.get();
cin.sync();
cout << "Введіть назву файлу: ";
cin.getline(filename, 99);
LoadFromFile(S, N, filename);
break;
case 5:
{
do
{
cout << "1 - Добавити" << endl;
cout << "2 - Вилучити" << endl;
cout << "3 - Редагувати" << endl;
cout << "0 - Вихід" << endl;
cout << "Введіть: ";
cin >> action_case_5;
} while (action_case_5 != 1 &&
action_case_5 != 2 &&
action_case_5 != 3 &&
action_case_5 != 0);
cout << endl;
switch (action_case_5)
{
case 1:
push_back(S, N++);
break;
case 2:
do
{
cout << "Виберіть рядок. який потрібно видалити: ";
cin >> row_del;
} while (row_del < 0);
del(S, N--, row_del - 1);
break;
case 3:
do
{
do
{
cout << "Що змінити?" << endl;
cout << "1 - Назва магазину" << endl;
cout << "2 - Назва товару" << endl;
cout << "3 - Вартість товару" << endl;
cout << "4 - Кількість товару" << endl;
cout << "Введіть: ";
cin >> what_modify;
} while (what_modify != 1 &&
what_modify != 2 &&
what_modify != 3 &&
what_modify != 4);
cout << endl;
switch (what_modify)
{
case 1:
case 2:
do
{
cout << "Введіть рядок: ";
cin >> row;
} while (row < 0);
cout << endl;
cout << "На що замінити? " << endl;
cin.get();
cin.sync();
cout << "Введіть: ";
getline(cin, modify_to_string);
Modify_string(S, N, what_modify, modify_to_string, row);
break;
case 3:
case 4:
do
{
cout << "Введіть рядок: ";
cin >> row;
} while (row < 0);
cout << endl;
cout << "На що замінити? " << endl;
cin.get();
cin.sync();
cout << "Введіть: ";
cin >> modify_to_int;
Modify_int(S, N, what_modify, modify_to_int, row);
break;
}
do
{
cout << "Бажаєте повторити корегування? (1 - Так, 2 - Ні)" << endl;
cout << "Введіть";
cin >> what_to_do;
} while (what_to_do != 1 &&
what_to_do != 2);
cout << endl;
} while (what_to_do != 2);
break;
case 0:
break;
}
break;
}
case 6:
cout << "За якими критеріями відсортувати?\n(1 - За назвою товару , 2 - За назвою магазину)" << endl;
do
{
cout << "Введіть: ";
cin >> SortType;
} while (SortType != 1 && SortType != 2);
Sort(S, N, SortType);
break;
case 7:
cin.get();
cin.sync();
cout << "Введіть назву товару: ";
getline(cin, item_name);
print_info_item(S, N, item_name);
break;
case 8:
cin.get();
cin.sync();
cout << "Введіть назву магазину: ";
getline(cin, shop_name);
print_info_shop(S, N, shop_name);
break;
case 0:
return 0;
default:
cout << "Помилка!" << endl;
}
} while (action != 0);
return 0;
}
void Create(Shop* S, int N_start, const int N)
{
for (N_start; N_start < N; N_start++)
{
cout << "Товар №" << N_start + 1 << endl;
cout << "Назву магазину: ";
cin >> S[N_start].shop_name;
cout << "Назву товару: ";
cin >> S[N_start].item_name;
cout << "Ціна за одиницю(грн.): ";
cin >> S[N_start].price_for_item;
cout << "Кількість(Шт., 1 упаковка = 20 кг.): ";
cin >> S[N_start].amount_of_items;
cout << endl
<< endl;
}
}
void Print(Shop* S, const int N)
{
cout << "==================================================================================" << endl;
cout << "| № | Назва магазину | Назва товару | Вартість товару | Кількість товару |" << endl;
cout << "----------------------------------------------------------------------------------" << endl;
for (int i = 0; i < N; i++)
{
cout << "|" << setw(2) << i + 1 << setw(2);
cout << "|" << setw(10) << S[i].shop_name << setw(9);
cout << "|" << setw(8) << S[i].item_name << setw(9);
cout << "|" << setw(10) << S[i].price_for_item << setw(10);
cout << "|" << setw(10) << S[i].amount_of_items << setw(11) << "|" << endl;
}
cout << "==================================================================================" << endl
<< endl;
}
void SaveToFile(Shop* S, const int N, const char* filename)
{
ofstream fout(filename, ios::binary);
fout.write((char*)&N, sizeof(N));
for (int i = 0; i < N; i++)
fout.write((char*)&S[i], sizeof(Shop));
fout.close();
}
void LoadFromFile(Shop*& S, int& N, const char* filename)
{
delete[] S;
ifstream fin(filename, ios::binary);
fin.read((char*)&N, sizeof(N));
S = new Shop[N];
for (int i = 0; i < N; i++)
fin.read((char*)&S[i], sizeof(Shop));
fin.close();
}
void Sort(Shop* S, const int N, int SortType)
{
string Check, Check_Next;
Shop tmp;
for (int i0 = 0; i0 < N - 1; i0++)
{
for (int i1 = 0; i1 < N - i0 - 1; i1++)
{
switch (SortType)
{
case 1:
Check = S[i1].item_name;
Check_Next = S[i1 + 1].item_name;
break;
default:
Check = S[i1].shop_name;
Check_Next = S[i1 + 1].shop_name;
break;
}
if (Check > Check_Next)
{
tmp = S[i1];
S[i1] = S[i1 + 1];
S[i1 + 1] = tmp;
}
}
}
}
void Modify_string(Shop* S, const int N, int what_modify, string modify_to_string, int row)
{
switch (what_modify)
{
case 1:
S[row - 1].shop_name = modify_to_string;
break;
case 2:
S[row - 1].item_name = modify_to_string;
break;
}
}
void Modify_int(Shop* S, const int N, int what_modify, int modify_to_int, int row)
{
switch (what_modify)
{
case 3:
S[row - 1].price_for_item = modify_to_int;
break;
case 4:
S[row - 1].amount_of_items = modify_to_int;
break;
}
}
void print_info_item(Shop* S, const int N, string item_name)
{
cout << "==================================================================================" << endl;
cout << "| № | Назва магазину | Назва товару | Вартість товару | Кількість товару |" << endl;
cout << "----------------------------------------------------------------------------------" << endl;
for (int i = 0; i < N; i++)
{
if (S[i].item_name == item_name)
{
cout << "|" << setw(2) << i + 1 << setw(2);
cout << "|" << setw(10) << S[i].shop_name << setw(9);
cout << "|" << setw(8) << S[i].item_name << setw(9);
cout << "|" << setw(10) << S[i].price_for_item << setw(10);
cout << "|" << setw(10) << S[i].amount_of_items << setw(11) << "|" << endl;
}
}
cout << "==================================================================================" << endl
<< endl;
}
void print_info_shop(Shop* S, const int N, string shop_name)
{
cout << "==================================================================================" << endl;
cout << "| № | Назва магазину | Назва товару | Вартість товару | Кількість товару |" << endl;
cout << "----------------------------------------------------------------------------------" << endl;
for (int i = 0; i < N; i++)
{
if (S[i].shop_name == shop_name)
{
cout << "|" << setw(2) << i + 1 << setw(2);
cout << "|" << setw(10) << S[i].shop_name << setw(9);
cout << "|" << setw(8) << S[i].item_name << setw(9);
cout << "|" << setw(10) << S[i].price_for_item << setw(10);
cout << "|" << setw(10) << S[i].amount_of_items << setw(11) << "|" << endl;
}
}
cout << "==================================================================================" << endl
<< endl;
}
void push_back(Shop*& S, int N)
{
Shop* New_S = new Shop[N + 1];
for (int i = 0; i < N; i++)
{
New_S[i].shop_name = S[i].shop_name;
New_S[i].item_name = S[i].item_name;
New_S[i].price_for_item = S[i].price_for_item;
New_S[i].amount_of_items = S[i].amount_of_items;
}
cout << "Назву магазину: ";
cin >> New_S[N].shop_name;
cout << "Назву товару: ";
cin >> New_S[N].item_name;
cout << "Ціна за одиницю(грн.): ";
cin >> New_S[N].price_for_item;
cout << "Кількість(Шт., 1 упаковка = 20 кг.): ";
cin >> New_S[N].amount_of_items;
delete[] S;
S = New_S;
}
void del(Shop*& S, int N, int row_del)
{
int i = 0;
Shop* New_S = new Shop[N - 1];
for (i; i < row_del; i++)
{
New_S[i].shop_name = S[i].shop_name;
New_S[i].item_name = S[i].item_name;
New_S[i].price_for_item = S[i].price_for_item;
New_S[i].amount_of_items = S[i].amount_of_items;
}
for (i; i < N - 1; i++)
{
New_S[i].shop_name = S[i + 1].shop_name;
New_S[i].item_name = S[i + 1].item_name;
New_S[i].price_for_item = S[i + 1].price_for_item;
New_S[i].amount_of_items = S[i + 1].amount_of_items;
}
delete[] S;
S = New_S;
} |
0de01b5e3c7dea8fa299b265ea0dc69d899f8311 | 694df92026911544a83df9a1f3c2c6b321e86916 | /c++/Test/GlobalData/weoGlobalData.cpp | 0a44030f9ee9d3b0372010d1700b0921a5c23010 | [
"MIT"
] | permissive | taku-xhift/labo | f485ae87f01c2f45e4ef1a2a919cda7e571e3f13 | 89dc28fdb602c7992c6f31920714225f83a11218 | refs/heads/main | 2021-12-10T21:19:29.152175 | 2021-08-14T21:08:51 | 2021-08-14T21:08:51 | 81,219,052 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,221 | cpp | weoGlobalData.cpp |
#include "pm_mode.cnf"
#if (PM_MODE_ALLMENU_OFF != 1)
//-----------------------------------------------------
// include
//-----------------------------------------------------
#include "weoGlobalData.h"
#include "weDebug.h"
#define PUSH_RELEASE(ptr, some)
GlobalData* GlobalData::this_ = NULL;
GlobalData::Mutex GlobalData::mutex_;
/********************************************************************
* @brief str から trimmer を取り除く
* @param[in, out] str 取り除かれる文字列
* @param[in] trimmer 取り除く文字列
*******************************************************************/
void strTrimming(std::string& str, const std::string& trimmer) throw() {
std::string::size_type pos = 0;
while(pos = str.find(trimmer, pos), pos != std::string::npos) {
str.erase(pos, trimmer.length());
}
}
/********************************************************************
* @brief getInstance 可能かどうか
* @retval true 可能。
* @retval false 不可能。create がされていない
*******************************************************************/
bool GlobalData::hasData() throw() { return (this_ != NULL); }
/********************************************************************
* @brief オブジェクト取得
* @note const 参照の返却。
* データをセットしたい場合は素直に set を呼ぶこと
* @return クラスオブジェクト
* @except UnReadyLoadData メモリが NULL だった
*******************************************************************/
const GlobalData& GlobalData::getInstance() throw(pm_mode::task::UnReadyLoadData) {
if (this_ == NULL) {
throw pm_mode::task::UnReadyLoadData("Error in getting instance!!!");
}
return *this_;
}
/********************************************************************
* @brief メモリ確保
*******************************************************************/
void GlobalData::create() throw(pm_mode::task::MemoryAllocateException) {
try {
if (this_ == NULL) {
UpLock uplock(mutex_);
WriteLock writeLock(uplock);
if (this_ == NULL) {
this_ = NEW GlobalData();
// 解放関数の登録
PUSH_RELEASE(GlobalData::destroy, NULL);
}
}
} catch (std::bad_alloc&) {
throw pm_mode::task::MemoryAllocateException(ExceptionMessage("Memory allocation error!!!"));
}
}
/********************************************************************
* @brief メモリ解放
*******************************************************************/
void GlobalData::destroy() throw() {
SAFE_DELETE(this_);
}
/********************************************************************
* @brief constructor
*******************************************************************/
GlobalData::GlobalData() throw()
{
}
/********************************************************************
* @brief destructor
*******************************************************************/
GlobalData::~GlobalData() throw()
{
#if (!MASTER)
#endif // (!MASTER)
}
#endif // #if (PM_MODE_ALLMENU_OFF != 1)
|
da83c1e1a74713e9384e16c8a79d2af28fc84f4e | 3098059055899481e2be7bfca111a2ce8154f7f5 | /Serial/serial_debug/serial_debug.ino | bd46fd6fce8d0722ad90906613f3ea6f38fbd5d7 | [] | no_license | fishmingyu/mechanic_arm | f12c951fa95caff5fe32e3f91034a65ae107f5e2 | 5a217f2da1f00c606ab79f87234535148de297b8 | refs/heads/master | 2020-07-09T09:56:59.750304 | 2019-08-28T18:27:42 | 2019-08-28T18:27:42 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,797 | ino | serial_debug.ino | bool catch_valid = false;
double X, Y, Z, L; //以腰部舵机中心建立坐标系,直角坐标系与柱坐标系相互转换
byte theta; //底盘的极角,极轴以底盘舵机90˚方向,theta为弧度制
byte angle_alpha;
//X = L * cos(theta); Y = L * sin(theta);
String Z_store = "", L_store = "", theta_store = "", STORE = "", alpha_store = "";
void setup()
{
Serial.begin(9600);
Serial.println("********Serial Start*********");
}
void loop()
{
input_scheme();
}
void input_scheme() //调试时使用的向Serial中输入
{
double stringToDouble(const String &);
char data; //字符型数据
char *data_store;
int data_length, index[3], j = 0;
while (Serial.available() > 0) //读取字符串
{
data = Serial.read(); //读取数据
STORE += data; //拼接衬成为字符串
delay(2); //延时,等待传输
}
if (STORE.length() > 0) //如果已经读取,且不为空
{
Serial.println(STORE);
data_length = STORE.length() + 1;
data_store = new char[data_length];
STORE.toCharArray(data_store, data_length);
for (int i = 0; i < data_length; i++)
{
if (data_store[i] == ',')
{
index[j] = i; //记录index的位置
j++;
}
}
Z_store = STORE.substring(0, index[0]); //读取子字符串
L_store = STORE.substring(index[0] + 1, index[1]);
theta_store = STORE.substring(index[1] + 1, index[2]);
alpha_store = STORE.substring(index[2] + 1, data_length - 2);
Z = stringToDouble(Z_store);
L = stringToDouble(L_store);
theta = stringToDouble(theta_store);
angle_alpha = stringToDouble(alpha_store);
Serial.print("Z is: ");
Serial.println(Z);
Serial.print("L is: ");
Serial.println(L);
Serial.print("theta is: ");
Serial.println(theta);
Serial.print("alpha is: ");
Serial.println(angle_alpha);
catch_valid = true;
}
else
{
catch_valid = false;
}
STORE = ""; //置为空,等待下一次读取
Z_store = "";
L_store = "";
theta_store = "";
alpha_store = "";
delete data_store;
}
double stringToDouble(const String &str)
{
double returnValue = 0;
int index = 0;
int dotIndex = (int)str.length();
for (; index < str.length(); index++)
{
if (str[index] == '.')
{
dotIndex = index;
index++;
break;
}
if(str[index]<'0'||str[index]>'9')
{
return 0;
}
returnValue = 10 * returnValue + str[index] - '0';
}
for (; index < str.length(); index++)
{
if(str[index]<'0'||str[index]>'9')
{
return 0;
}
returnValue += double(str[index] - '0') / (double)pow(10, (index - dotIndex));
}
return returnValue;
}
|
e3840c113c66769542edfbed4f0aefeb031a9e6d | 341f61df4841409719462de654dcacfebce89784 | /sudao-smsp/01_trunk/source/smsp_c2s/direct/SMGPConnectReq.h | c4656edfd06734b18e365dff5dca3e83028bd781 | [] | no_license | jarven-zhang/paas_smsp | ebc0bbec8d3296d56a1adc6b49846b60237539a8 | 5bb8f59a54fa5013e144e91187781a487a767dca | refs/heads/master | 2020-05-15T18:31:48.082722 | 2019-05-07T12:35:33 | 2019-05-07T12:35:33 | 182,426,035 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,238 | h | SMGPConnectReq.h | #ifndef SMGPCONNECTREQ_H_
#define SMGPCONNECTREQ_H_
#include "SMGPBase.h"
namespace smsp
{
class SMGPConnectReq: public SMGPBase
{
public:
SMGPConnectReq();
virtual ~SMGPConnectReq();
SMGPConnectReq(const SMGPConnectReq& other)
{
this->clientId_ = other.clientId_;
this->authClient_ = other.authClient_;
this->loginMode_ = other.loginMode_;
this->timestamp_ = other.timestamp_;
this->clientVersion_ = other.clientVersion_;
}
SMGPConnectReq& operator =(const SMGPConnectReq& other)
{
this->clientId_ = other.clientId_;
this->authClient_ = other.authClient_;
this->loginMode_ = other.loginMode_;
this->timestamp_ = other.timestamp_;
this->clientVersion_ = other.clientVersion_;
return *this;
}
void setAccout(std::string cliendID, std::string password)
{
clientId_ = cliendID;
password_ = password;
createAuthSource();
}
void createAuthSource();
public:
virtual UInt32 bodySize() const;
virtual bool Pack(Writer &writer) const;
virtual bool Unpack(Reader &reader);
public:
std::string password_;
// SMGP_LOGIN 8,16,1,4,1
std::string clientId_;
std::string authClient_;
UInt8 loginMode_;
UInt32 timestamp_;
UInt8 clientVersion_;
};
}
#endif
|
e1c70cbe07a803eb2d00a05b2c3bce055fe405f9 | 48341608d6141a16f636b248496f9faf33c50a7e | /Academic/C/Aps/funcoes/EX6.cpp | bd2b944d0b6877c4c1675bad6ff4fbb586a46d55 | [] | no_license | joaogqueiroz/Projetos_C | 0b036974f64fb654b454c3281ac4a404d222efed | 95e66540f78bac74a5d481c33ba39d123e5178e4 | refs/heads/master | 2020-04-08T21:31:30.879603 | 2019-11-20T14:01:32 | 2019-11-20T14:01:32 | 159,747,566 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 429 | cpp | EX6.cpp | #include <stdio.h>
#include <stdlib.h>
void calcula_tempo( int &hora, int &minuto){
int min_hora=60;
hora=minuto/min_hora;//calcula hora
minuto=(minuto-(min_hora*hora)); //calcula minutos
}
int main(){
int minuto,hora=0;
printf("Informe a quantidade de minutos: \n\n");
scanf("%d",&minuto);
calcula_tempo(hora,minuto);
printf("\n\nJa se passaram: %d hora(s) e %d minuto(s)\n\n",hora,minuto);
system("pause");
return 0;
}
|
af90c4e0566016f7486b25f2a89254349cc43476 | 80b3a67d2b9eef27bfccf1364b5e866f840f22c9 | /codes/obc/dependencies/rodos/tutorials/60-tutorial-big-application/simple/common/globaldata.cpp | 9eba6fd58ca2459c258686a3b5fa95404738195f | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | sabil62/Floatsat | b00598239dd5fa00234927c533ec3b90369da4a8 | a02ce5a228ea82f539aa1845ed6f8edeba85a885 | refs/heads/main | 2023-06-08T10:13:51.741052 | 2023-05-25T17:11:44 | 2023-05-25T17:11:44 | 371,999,803 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 155 | cpp | globaldata.cpp |
#include "rodos.h"
#include "common.h"
// @autor: Sergio Montenegro, Uni Wuezburg
namespace Common {
uint32_t counter1 = 0;
uint32_t counter2 = 0;
}
|
40ce856374bea3d9af1631a18adad14334990700 | 4110496fb8b6cf7fbdabf9682f07255b6dab53f3 | /BFS/45. [Like And Useful] Jump Game II.cpp | ea3748007c02691b09ae7acbb97b324a597483f3 | [] | no_license | louisfghbvc/Leetcode | 4cbfd0c8ad5513f60242759d04a067f198351805 | 1772036510638ae85b2d5a1a9e0a8c25725f03bd | refs/heads/master | 2023-08-22T19:20:30.466651 | 2023-08-13T14:34:58 | 2023-08-13T14:34:58 | 227,853,839 | 4 | 0 | null | 2020-11-20T14:02:18 | 2019-12-13T14:09:25 | C++ | UTF-8 | C++ | false | false | 526 | cpp | 45. [Like And Useful] Jump Game II.cpp | // think it as bfs. shortest path problem. O(N).
// say 2 3 1 1 4.
// level 0: 2
// level 1: 3 1
// level 2: 1 4.
class Solution {
public:
int jump(vector<int>& nums) {
int n = nums.size(), step = 0, start = 0, cur = 0, next = 0;
while(start < n-1){
step++;
for(; start <= cur; ++start){
if(start + nums[start] >= n-1) return step;
next = max(next, start + nums[start]);
}
cur = next;
}
return step;
}
};
|
4dc465a914279d913f13b7d2fa37149127d20eed | a305b232694c4965458587933a9282195507707d | /URI/1796.cpp | a5f0a303b9cf36fa48f1281d24c6c5c7ea578a47 | [] | no_license | gustavo-candido/ONLINE-JUDGE | d1596a0d1b7960fc35686c8edb57e8360146a309 | 0b4070db187b4ff5761008039d4a5de426b07cf8 | refs/heads/master | 2022-06-09T10:33:40.956799 | 2022-05-13T18:11:36 | 2022-05-13T18:11:36 | 198,307,436 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 223 | cpp | 1796.cpp | #include <bits/stdc++.h>
#define _n 233005
using namespace std;
int main()
{
int n, v=0, aux;
scanf("%d", &n);
for(int i=0; i<n; i++) {
scanf("%d",&aux);
if(!aux)v++;
}
if(v > n/2) puts("Y");
else puts("N");
} |
bc924362035c8d3fdfd78b9a2b2e6eb61b6c85ac | be6494ca016157a7051856f678a4a2749821f716 | /sources/src/client/reader/TibiaClientMemoryReader.cpp | 4402b8b4214687f4e1aa406cbeb4b66b38f7a671 | [] | no_license | stryku/amb | 9ffd00d57694e44b814631b48d32b9e64968f105 | f2738e58d104e8dcb87e91c8fdf0bbaf1ac445aa | refs/heads/master | 2021-01-20T06:31:09.805810 | 2017-03-22T22:21:18 | 2017-03-22T22:21:18 | 82,597,607 | 1 | 0 | null | 2017-03-22T22:21:19 | 2017-02-20T20:05:19 | C++ | UTF-8 | C++ | false | false | 808 | cpp | TibiaClientMemoryReader.cpp | #include "client/reader/TibiaClientMemoryReader.hpp"
#include "memory/Addresses.hpp"
#include <cstdint>
namespace Amb
{
namespace Client
{
namespace Reader
{
TibiaClientMemoryReader::TibiaClientMemoryReader(DWORD pid)
: processMemoryReader{ pid }
{}
void TibiaClientMemoryReader::attachToNewProcess(DWORD pid)
{
processMemoryReader.attachNewProcess(pid);
}
size_t TibiaClientMemoryReader::readCap()
{
const auto xor = processMemoryReader.read<uint32_t>(Memory::Addresses::kXor);
const auto cap = processMemoryReader.read<uint32_t>(Memory::Addresses::kCap);
return (xor ^ cap) / 100;
}
}
}
}
|
3b74a879403580e287f95a43704162ba7997470b | 500e57cbb3ca8c2a8ff3823940bac66cd8c9b89b | /CS3113_HW_5/CS3113 HW5/Entity.cpp | 08e271761abb608d7b5580b3b3cc40031950cf3d | [] | no_license | KaYBlitZ/CS3113-HW | e0d0c937747ca39d7a6dd523ccc94629d10d59e0 | 5a89813103c8d1848adbbf2c336c721b75f0e237 | refs/heads/master | 2020-06-05T03:56:57.223393 | 2015-05-11T16:51:46 | 2015-05-11T16:51:46 | 30,125,405 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 915 | cpp | Entity.cpp | #include "Entity.h"
Entity::Entity() : x(0.0f), y(0.0f), xVel(0.0f), yVel(0.0f), xAccel(0.0f), yAccel(0.0f), remove(false) {}
Entity::Entity(float x, float y, SheetSprite sprite) : x(x), y(y), xVel(0.0f), yVel(0.0f), xAccel(0.0f), yAccel(0.0f),
sprite(sprite), remove(false) {}
Entity::Entity(const Entity& rhs) : x(rhs.x), y(rhs.y), xVel(rhs.xVel), yVel(rhs.yVel), xAccel(rhs.xAccel), yAccel(rhs.yAccel),
sprite(rhs.sprite), remove(rhs.remove) {}
Entity& Entity::operator=(const Entity& rhs) {
if (&rhs != this) {
x = rhs.x;
y = rhs.y;
xVel = rhs.xVel;
yVel = rhs.yVel;
xAccel = rhs.xAccel;
yAccel = rhs.yAccel;
remove = rhs.remove;
sprite = rhs.sprite;
}
return *this;
}
void Entity::render() {
sprite.draw(x, y);
}
float Entity::getWidth() {
return sprite.texWidth * sprite.scale;
}
float Entity::getHeight() {
return sprite.texHeight * sprite.scale;
} |
e194e580159d50c33521d2fc2dc8f17adc0af607 | 86f313355cd81393329ab1b52fb5d29d444593c2 | /SheetEditorView.h | 09e9c888a24bed5e241b370f4c2818a446fb2882 | [] | no_license | meh2481/SpriteSheeter | afa95dded2351754df362dc635e41effa4ce9e81 | 6fdf0dd10af107dbfc7c40431a7b71ff4fb7911d | refs/heads/master | 2021-01-17T15:11:48.487825 | 2017-08-02T15:55:03 | 2017-08-02T15:55:03 | 38,405,967 | 19 | 5 | null | 2017-08-02T15:55:04 | 2015-07-02T02:12:03 | C++ | UTF-8 | C++ | false | false | 803 | h | SheetEditorView.h | #ifndef SHEETEDITORVIEW_H
#define SHEETEDITORVIEW_H
#include <QGraphicsView>
#include <QMouseEvent>
#include <QScrollBar>
class SheetEditorView : public QGraphicsView
{
Q_OBJECT
bool _pan;
int _panStartX, _panStartY;
public:
explicit SheetEditorView(QWidget *parent = 0);
~SheetEditorView();
void dragEnterEvent(QDragEnterEvent *e);
void dropEvent(QDropEvent *e);
void dragMoveEvent(QDragMoveEvent *e);
signals:
void mouseMoved(int x, int y);
void mousePressed(int x, int y);
void mouseReleased(int x, int y);
void droppedFiles(QStringList sl);
void droppedFolders(QStringList sl);
protected:
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
};
#endif
|
c1ca076d001379dc3df16594d6f5ebbf28dbf42e | 8be023f90d9a18f4917af4bba8fb31230df3df2a | /SigLog_Lib/transports/snmpSSHDomain.cpp | 7ec702bd6d4ed917bf092419b8bd107d3519b062 | [] | no_license | duniansampa/SigLog | d6dba1c0e851e1c8d3aef3af4bb85b4d038ab9c9 | 3dae0e42a36ebc5dca46fb044d3b1d40152ec786 | refs/heads/master | 2021-01-10T12:25:17.511236 | 2016-03-12T18:38:19 | 2016-03-12T18:38:19 | 44,571,851 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 33,007 | cpp | snmpSSHDomain.cpp | #include <sigLogH/net-snmp-config.h>
#include <sigLogH/net-snmp-features.h>
#include <sigLogH/library/snmpSSHDomain.h>
#include <stdio.h>
#include <sys/types.h>
#include <errno.h>
#include <libssh2.h>
#include <libssh2_sftp.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#if HAVE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif
#if HAVE_STDLIB_H
#include <stdlib.h>
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#if HAVE_SYS_UN_H
#include <sys/un.h>
#endif
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#if HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#if HAVE_FCNTL_H
#include <fcntl.h>
#endif
#if HAVE_DMALLOC_H
#include <dmalloc.h>
#endif
#include <pwd.h>
#ifndef MAXPATHLEN
#warn no system max path length detected
#define MAXPATHLEN 2048
#endif
#include <sigLogH/types.h>
#include <sigLogH/output_api.h>
#include <sigLogH/library/tools.h>
#include <sigLogH/library/system.h>
#include <sigLogH/library/default_store.h>
#include <sigLogH/library/snmp_transport.h>
#include <sigLogH/library/snmpIPv4BaseDomain.h>
#include <sigLogH/library/snmpSocketBaseDomain.h>
#include <sigLogH/library/read_config.h>
netsnmp_feature_require(user_information)
#define MAX_NAME_LENGTH 127
#define NETSNMP_SSHTOSNMP_VERSION1 1
#define NETSNMP_MAX_SSHTOSNMP_VERSION 1
#define DEFAULT_SOCK_NAME "sshdomainsocket"
typedef struct netsnmp_ssh_addr_pair_s {
struct sockaddr_in remote_addr;
struct in_addr local_addr;
LIBSSH2_SESSION *session;
LIBSSH2_CHANNEL *channel;
char username[MAX_NAME_LENGTH+1];
struct sockaddr_un unix_socket_end;
char socket_path[MAXPATHLEN];
} netsnmp_ssh_addr_pair;
const oid netsnmp_snmpSSHDomain[] = { TRANSPORT_DOMAIN_SSH_IP };
static netsnmp_tdomain sshDomain;
#define SNMPSSHDOMAIN_USE_EXTERNAL_PIPE 1
/*
* Not static since it is needed here as well as in snmpUDPDomain, but not
* public either
*/
int
netsnmp_sockaddr_in2(struct sockaddr_in *addr,
const char *inpeername, const char *default_target);
/*
* Return a string representing the address in data, or else the "far end"
* address if data is NULL.
*/
static char *
netsnmp_ssh_fmtaddr(netsnmp_transport *t, void *data, int len)
{
netsnmp_ssh_addr_pair *addr_pair = NULL;
if (data != NULL && len == sizeof(netsnmp_ssh_addr_pair)) {
addr_pair = (netsnmp_ssh_addr_pair *) data;
} else if (t != NULL && t->data != NULL) {
addr_pair = (netsnmp_ssh_addr_pair *) t->data;
}
if (addr_pair == NULL) {
return strdup("SSH: unknown");
} else {
struct sockaddr_in *to = NULL;
char tmp[64];
to = (struct sockaddr_in *) &(addr_pair->remote_addr);
if (to == NULL) {
return strdup("SSH: unknown");
}
sprintf(tmp, "SSH: [%s]:%hd",
inet_ntoa(to->sin_addr), ntohs(to->sin_port));
return strdup(tmp);
}
}
/*
* You can write something into opaque that will subsequently get passed back
* to your send function if you like. For instance, you might want to
* remember where a PDU came from, so that you can send a reply there...
*/
static int
netsnmp_ssh_recv(netsnmp_transport *t, void *buf, int size,
void **opaque, int *olength)
{
int rc = -1;
netsnmp_tmStateReference *tmStateRef = NULL;
netsnmp_ssh_addr_pair *addr_pair = NULL;
int iamclient = 0;
DEBUGMSGTL(("ssh", "at the top of ssh_recv\n"));
DEBUGMSGTL(("ssh", "t=%p\n", t));
if (t != NULL && t->data != NULL) {
addr_pair = (netsnmp_ssh_addr_pair *) t->data;
}
DEBUGMSGTL(("ssh", "addr_pair=%p\n", addr_pair));
if (t != NULL && addr_pair && addr_pair->channel) {
DEBUGMSGTL(("ssh", "t=%p, addr_pair=%p, channel=%p\n",
t, addr_pair, addr_pair->channel));
iamclient = 1;
while (rc < 0) {
rc = libssh2_channel_read(addr_pair->channel, buf, size);
if (rc < 0) { /* XXX: from tcp; ssh equiv?: && errno != EINTR */
DEBUGMSGTL(("ssh", "recv fd %d err %d (\"%s\")\n",
t->sock, errno, strerror(errno)));
break;
}
DEBUGMSGTL(("ssh", "recv fd %d got %d bytes\n",
t->sock, rc));
}
} else if (t != NULL) {
#ifdef SNMPSSHDOMAIN_USE_EXTERNAL_PIPE
socklen_t tolen = sizeof(struct sockaddr_un);
if (t != NULL && t->sock >= 0) {
struct sockaddr *to;
to = (struct sockaddr *) SNMP_MALLOC_STRUCT(sockaddr_un);
if (NULL == to) {
*opaque = NULL;
*olength = 0;
return -1;
}
if(getsockname(t->sock, to, &tolen) != 0){
free(to);
*opaque = NULL;
*olength = 0;
return -1;
};
if (addr_pair->username[0] == '\0') {
/* we don't have a username yet, so this is the first message */
struct ucred *remoteuser;
struct msghdr msg;
struct iovec iov[1];
char cmsg[CMSG_SPACE(sizeof(remoteuser))+4096];
struct cmsghdr *cmsgptr;
u_char *charbuf = buf;
iov[0].iov_base = buf;
iov[0].iov_len = size;
memset(&msg, 0, sizeof msg);
msg.msg_iov = iov;
msg.msg_iovlen = 1;
msg.msg_control = &cmsg;
msg.msg_controllen = sizeof(cmsg);
rc = recvmsg(t->sock, &msg, MSG_DONTWAIT); /* use DONTWAIT? */
if (rc <= 0) {
return rc;
}
/* we haven't received the starting info */
if ((u_char) charbuf[0] > NETSNMP_SSHTOSNMP_VERSION1) {
/* unsupported connection version */
snmp_log(LOG_ERR, "received unsupported sshtosnmp version: %d\n", charbuf[0]);
return -1;
}
DEBUGMSGTL(("ssh", "received first msg over SSH; internal SSH protocol version %d\n", charbuf[0]));
for (cmsgptr = CMSG_FIRSTHDR(&msg); cmsgptr != NULL; cmsgptr = CMSG_NXTHDR(&msg, cmsgptr)) {
if (cmsgptr->cmsg_level == SOL_SOCKET && cmsgptr->cmsg_type == SCM_CREDENTIALS) {
/* received credential info */
struct passwd *user_pw;
remoteuser = (struct ucred *) CMSG_DATA(cmsgptr);
if ((user_pw = getpwuid(remoteuser->uid)) == NULL) {
snmp_log(LOG_ERR, "No user found for uid %d\n",
remoteuser->uid);
return -1;
}
if (strlen(user_pw->pw_name) >
sizeof(addr_pair->username)-1) {
snmp_log(LOG_ERR,
"User name '%s' too long for snmp\n",
user_pw->pw_name);
return -1;
}
strlcpy(addr_pair->username, user_pw->pw_name,
sizeof(addr_pair->username));
}
DEBUGMSGTL(("ssh", "Setting user name to %s\n",
addr_pair->username));
}
if (addr_pair->username[0] == '\0') {
snmp_log(LOG_ERR,
"failed to extract username from sshd connected unix socket\n");
return -1;
}
if (rc == 1) {
/* the only packet we received was the starting one */
t->flags |= NETSNMP_TRANSPORT_FLAG_EMPTY_PKT;
return 0;
}
rc -= 1;
memmove(charbuf, &charbuf[1], rc);
} else {
while (rc < 0) {
rc = recvfrom(t->sock, buf, size, 0, NULL, NULL);
if (rc < 0 && errno != EINTR) {
DEBUGMSGTL(("ssh", "recv fd %d err %d (\"%s\")\n",
t->sock, errno, strerror(errno)));
return rc;
}
*opaque = (void*)to;
*olength = sizeof(struct sockaddr_un);
}
}
DEBUGMSGTL(("ssh", "recv fd %d got %d bytes\n",
t->sock, rc));
}
#else /* we're called directly by sshd and use stdin/out */
struct passwd *user_pw;
iamclient = 0;
/* we're on the server side and should read from stdin */
while (rc < 0) {
rc = read(STDIN_FILENO, buf, size);
if (rc < 0 && errno != EINTR) {
DEBUGMSGTL(("ssh",
" read on stdin failed: %d (\"%s\")\n",
errno, strerror(errno)));
break;
}
if (rc == 0) {
/* 0 input is probably bad since we selected on it */
DEBUGMSGTL(("ssh", "got a 0 read on stdin\n"));
return -1;
}
DEBUGMSGTL(("ssh", "read on stdin got %d bytes\n", rc));
}
/* XXX: need to check the username, but addr_pair doesn't exist! */
/*
DEBUGMSGTL(("ssh", "current username=%s\n", c));
if (addr_pair->username[0] == '\0') {
if ((user_pw = getpwuid(getuid())) == NULL) {
snmp_log(LOG_ERR, "No user found for uid %d\n", getuid());
return -1;
}
if (strlen(user_pw->pw_name) > sizeof(addr_pair->username)-1) {
snmp_log(LOG_ERR, "User name '%s' too long for snmp\n",
user_pw->pw_name);
return -1;
}
strlcpy(addr_pair->username, user_pw->pw_name,
sizeof(addr_pair->username));
}
*/
#endif /* ! SNMPSSHDOMAIN_USE_EXTERNAL_PIPE */
}
/* create a tmStateRef cache */
tmStateRef = SNMP_MALLOC_TYPEDEF(netsnmp_tmStateReference);
/* secshell document says were always authpriv, even if NULL algorithms */
/* ugh! */
/* XXX: disallow NULL in our implementations */
tmStateRef->transportSecurityLevel = SNMP_SEC_LEVEL_AUTHPRIV;
/* XXX: figure out how to get the specified local secname from the session */
if (iamclient && 0) {
/* XXX: we're on the client; we should have named the
connection ourselves... pull this from session somehow? */
strlcpy(tmStateRef->securityName, addr_pair->username,
sizeof(tmStateRef->securityName));
} else {
#ifdef SNMPSSHDOMAIN_USE_EXTERNAL_PIPE
strlcpy(tmStateRef->securityName, addr_pair->username,
sizeof(tmStateRef->securityName));
#else /* we're called directly by sshd and use stdin/out */
/* we're on the server... */
/* XXX: this doesn't copy properly and can get pointer
reference issues */
if (strlen(getenv("USER")) > 127) {
/* ruh roh */
/* XXX: clean up */
return -1;
exit;
}
/* XXX: detect and throw out overflow secname sizes rather
than truncating. */
strlcpy(tmStateRef->securityName, getenv("USER"),
sizeof(tmStateRef->securityName));
#endif /* ! SNMPSSHDOMAIN_USE_EXTERNAL_PIPE */
}
tmStateRef->securityName[sizeof(tmStateRef->securityName)-1] = '\0';
tmStateRef->securityNameLen = strlen(tmStateRef->securityName);
*opaque = tmStateRef;
*olength = sizeof(netsnmp_tmStateReference);
return rc;
}
static int
netsnmp_ssh_send(netsnmp_transport *t, void *buf, int size,
void **opaque, int *olength)
{
int rc = -1;
netsnmp_ssh_addr_pair *addr_pair = NULL;
netsnmp_tmStateReference *tmStateRef = NULL;
if (t != NULL && t->data != NULL) {
addr_pair = (netsnmp_ssh_addr_pair *) t->data;
}
if (opaque != NULL && *opaque != NULL &&
*olength == sizeof(netsnmp_tmStateReference)) {
tmStateRef = (netsnmp_tmStateReference *) *opaque;
}
if (!tmStateRef) {
/* this is now an error according to my memory in the recent draft */
snmp_log(LOG_ERR, "netsnmp_ssh_send wasn't passed a valid tmStateReference\n");
return -1;
}
if (NULL != t && NULL != addr_pair && NULL != addr_pair->channel) {
if (addr_pair->username[0] == '\0') {
strlcpy(addr_pair->username, tmStateRef->securityName,
sizeof(addr_pair->username));
} else if (strcmp(addr_pair->username, tmStateRef->securityName) != 0 ||
strlen(addr_pair->username) != tmStateRef->securityNameLen) {
/* error! they must always match */
snmp_log(LOG_ERR, "netsnmp_ssh_send was passed a tmStateReference with a securityName not equal to previous messages\n");
return -1;
}
while (rc < 0) {
rc = libssh2_channel_write(addr_pair->channel, buf, size);
if (rc < 0) { /* XXX: && errno != EINTR */
break;
}
}
} else if (t != NULL) {
#ifdef SNMPSSHDOMAIN_USE_EXTERNAL_PIPE
while (rc < 0) {
rc = sendto(t->sock, buf, size, 0, NULL, 0);
if (rc < 0 && errno != EINTR) {
break;
}
}
#else /* we're called directly by sshd and use stdin/out */
/* on the server; send to stdout */
while (rc < 0) {
rc = write(STDOUT_FILENO, buf, size);
fflush(stdout);
if (rc < 0 && errno != EINTR) { /* XXX: && errno != EINTR */
break;
}
}
#endif
}
return rc;
}
static int
netsnmp_ssh_close(netsnmp_transport *t)
{
int rc = -1;
netsnmp_ssh_addr_pair *addr_pair = NULL;
if (t != NULL && t->data != NULL) {
addr_pair = (netsnmp_ssh_addr_pair *) t->data;
}
if (t != NULL && addr_pair && t->sock >= 0) {
DEBUGMSGTL(("ssh", "close fd %d\n", t->sock));
if (addr_pair->channel) {
libssh2_channel_close(addr_pair->channel);
libssh2_channel_free(addr_pair->channel);
addr_pair->channel = NULL;
}
if (addr_pair->session) {
libssh2_session_disconnect(addr_pair->session, "Normal Shutdown");
libssh2_session_free(addr_pair->session);
addr_pair->session = NULL;
}
#ifndef HAVE_CLOSESOCKET
rc = close(t->sock);
#else
rc = closesocket(t->sock);
#endif
t->sock = -1;
#ifdef SNMPSSHDOMAIN_USE_EXTERNAL_PIPE
close(t->sock);
if (!addr_pair->session && !addr_pair->channel) {
/* unix socket based connection */
close(t->sock);
/* XXX: make configurable */
unlink(addr_pair->socket_path);
}
#else /* we're called directly by sshd and use stdin/out */
/* on the server: close stdin/out */
close(STDIN_FILENO);
close(STDOUT_FILENO);
#endif /* ! SNMPSSHDOMAIN_USE_EXTERNAL_PIPE */
} else {
#ifndef SNMPSSHDOMAIN_USE_EXTERNAL_PIPE
/* on the server: close stdin/out */
close(STDIN_FILENO);
close(STDOUT_FILENO);
#endif /* ! SNMPSSHDOMAIN_USE_EXTERNAL_PIPE */
}
return rc;
}
static int
netsnmp_ssh_accept(netsnmp_transport *t)
{
#ifdef SNMPSSHDOMAIN_USE_EXTERNAL_PIPE
/* much of this is duplicated from snmpUnixDomain.c */
netsnmp_ssh_addr_pair *addr_pair;
int newsock = -1;
struct sockaddr *farend = NULL;
socklen_t farendlen = sizeof(struct sockaddr_un);
if (t != NULL && t->sock >= 0) {
addr_pair = SNMP_MALLOC_TYPEDEF(netsnmp_ssh_addr_pair);
if (addr_pair == NULL) {
/*
* Indicate that the acceptance of this socket failed.
*/
DEBUGMSGTL(("ssh", "accept: malloc failed\n"));
return -1;
}
farend = (struct sockaddr *) &addr_pair->unix_socket_end;
newsock = accept(t->sock, farend, &farendlen);
/* set the SO_PASSCRED option so we can receive the remote uid */
{
int one = 1;
setsockopt(newsock, SOL_SOCKET, SO_PASSCRED, (void *) &one,
sizeof(one));
}
if (newsock < 0) {
DEBUGMSGTL(("ssh","accept failed rc %d errno %d \"%s\"\n",
newsock, errno, strerror(errno)));
free(addr_pair);
return newsock;
}
if (t->data != NULL) {
free(t->data);
}
DEBUGMSGTL(("ssh", "accept succeeded (farend %p len %d)\n",
farend, farendlen));
t->data = addr_pair;
t->data_length = sizeof(netsnmp_ssh_addr_pair);
netsnmp_sock_buffer_set(newsock, SO_SNDBUF, 1, 0);
netsnmp_sock_buffer_set(newsock, SO_RCVBUF, 1, 0);
return newsock;
} else {
return -1;
}
#else /* we're called directly by sshd and use stdin/out */
/* we don't need to do anything; server side uses stdin/out */
/* XXX: check that we're an ssh connection */
return STDIN_FILENO; /* return stdin */
#endif /* ! SNMPSSHDOMAIN_USE_EXTERNAL_PIPE */
}
/*
* Open a SSH-based transport for SNMP. Local is TRUE if addr is the local
* address to bind to (i.e. this is a server-type session); otherwise addr is
* the remote address to send things to.
*/
netsnmp_transport *
netsnmp_ssh_transport(struct sockaddr_in *addr, int local)
{
netsnmp_transport *t = NULL;
netsnmp_ssh_addr_pair *addr_pair = NULL;
int rc = 0;
int i, auth_pw = 0;
const char *fingerprint;
char *userauthlist;
struct sockaddr_un *unaddr;
const char *sockpath =
netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_LIB_SSHTOSNMP_SOCKET);
char tmpsockpath[MAXPATHLEN];
#ifdef NETSNMP_NO_LISTEN_SUPPORT
if (local)
return NULL;
#endif /* NETSNMP_NO_LISTEN_SUPPORT */
if (addr == NULL || addr->sin_family != AF_INET) {
return NULL;
}
t = SNMP_MALLOC_TYPEDEF(netsnmp_transport);
if (t == NULL) {
return NULL;
}
t->domain = netsnmp_snmpSSHDomain;
t->domain_length = netsnmp_snmpSSHDomain_len;
t->flags = NETSNMP_TRANSPORT_FLAG_STREAM | NETSNMP_TRANSPORT_FLAG_TUNNELED;
addr_pair = SNMP_MALLOC_TYPEDEF(netsnmp_ssh_addr_pair);
if (addr_pair == NULL) {
netsnmp_transport_free(t);
return NULL;
}
t->data = addr_pair;
t->data_length = sizeof(netsnmp_ssh_addr_pair);
if (local) {
#ifndef NETSNMP_NO_LISTEN_SUPPORT
#ifdef SNMPSSHDOMAIN_USE_EXTERNAL_PIPE
/* XXX: set t->local and t->local_length */
t->flags |= NETSNMP_TRANSPORT_FLAG_LISTEN;
unaddr = &addr_pair->unix_socket_end;
/* open a unix domain socket */
/* XXX: get data from the transport def for it's location */
unaddr->sun_family = AF_UNIX;
if (NULL == sockpath) {
sprintf(tmpsockpath, "%s/%s", get_persistent_directory(),
DEFAULT_SOCK_NAME);
sockpath = tmpsockpath;
}
strcpy(unaddr->sun_path, sockpath);
strcpy(addr_pair->socket_path, sockpath);
t->sock = socket(PF_UNIX, SOCK_STREAM, 0);
if (t->sock < 0) {
netsnmp_transport_free(t);
return NULL;
}
/* set the SO_PASSCRED option so we can receive the remote uid */
{
int one = 1;
setsockopt(t->sock, SOL_SOCKET, SO_PASSCRED, (void *) &one,
sizeof(one));
}
unlink(unaddr->sun_path);
rc = bind(t->sock, (struct sockaddr *) unaddr, SUN_LEN(unaddr));
if (rc != 0) {
DEBUGMSGTL(("netsnmp_ssh_transport",
"couldn't bind \"%s\", errno %d (%s)\n",
unaddr->sun_path, errno, strerror(errno)));
netsnmp_ssh_close(t);
netsnmp_transport_free(t);
return NULL;
}
/* set the socket permissions */
{
/*
* Apply any settings to the ownership/permissions of the
* Sshdomain socket
*/
int sshdomain_sock_perm =
netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_SSHDOMAIN_SOCK_PERM);
int sshdomain_sock_user =
netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_SSHDOMAIN_SOCK_USER);
int sshdomain_sock_group =
netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_SSHDOMAIN_SOCK_GROUP);
DEBUGMSGTL(("ssh", "here: %s, %d, %d, %d\n",
unaddr->sun_path,
sshdomain_sock_perm, sshdomain_sock_user,
sshdomain_sock_group));
if (sshdomain_sock_perm != 0) {
DEBUGMSGTL(("ssh", "Setting socket perms to %d\n",
sshdomain_sock_perm));
chmod(unaddr->sun_path, sshdomain_sock_perm);
}
if (sshdomain_sock_user || sshdomain_sock_group) {
/*
* If either of user or group haven't been set,
* then leave them unchanged.
*/
if (sshdomain_sock_user == 0 )
sshdomain_sock_user = -1;
if (sshdomain_sock_group == 0 )
sshdomain_sock_group = -1;
DEBUGMSGTL(("ssh", "Setting socket user/group to %d/%d\n",
sshdomain_sock_user, sshdomain_sock_group));
chown(unaddr->sun_path,
sshdomain_sock_user, sshdomain_sock_group);
}
}
rc = listen(t->sock, NETSNMP_STREAM_QUEUE_LEN);
if (rc != 0) {
DEBUGMSGTL(("netsnmp_ssh_transport",
"couldn't listen to \"%s\", errno %d (%s)\n",
unaddr->sun_path, errno, strerror(errno)));
netsnmp_ssh_close(t);
netsnmp_transport_free(t);
return NULL;
}
#else /* we're called directly by sshd and use stdin/out */
/* for ssh on the server side we've been launched so bind to
stdin/out */
/* nothing to do */
/* XXX: verify we're inside ssh */
t->sock = STDIN_FILENO;
#endif /* ! SNMPSSHDOMAIN_USE_EXTERNAL_PIPE */
#else /* NETSNMP_NO_LISTEN_SUPPORT */
return NULL;
#endif /* NETSNMP_NO_LISTEN_SUPPORT */
} else {
char *username;
char *keyfilepub;
char *keyfilepriv;
/* use the requested user name */
/* XXX: default to the current user name on the system like ssh does */
username = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_LIB_SSH_USERNAME);
if (!username || 0 == *username) {
snmp_log(LOG_ERR, "You must specify a ssh username to use. See the snmp.conf manual page\n");
return NULL;
}
/* use the requested public key file */
keyfilepub = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_LIB_SSH_PUBKEY);
if (!keyfilepub || 0 == *keyfilepub) {
/* XXX: default to ~/.ssh/id_rsa.pub */
snmp_log(LOG_ERR, "You must specify a ssh public key file to use. See the snmp.conf manual page\n");
return NULL;
}
/* use the requested private key file */
keyfilepriv = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_LIB_SSH_PRIVKEY);
if (!keyfilepriv || 0 == *keyfilepriv) {
/* XXX: default to keyfilepub without the .pub suffix */
snmp_log(LOG_ERR, "You must specify a ssh private key file to use. See the snmp.conf manual page\n");
return NULL;
}
/* xxx: need an ipv6 friendly one too (sigh) */
/* XXX: not ideal when structs don't actually match size wise */
memcpy(&(addr_pair->remote_addr), addr, sizeof(struct sockaddr_in));
t->sock = socket(PF_INET, SOCK_STREAM, 0);
if (t->sock < 0) {
netsnmp_transport_free(t);
return NULL;
}
t->remote = (u_char *)malloc(6);
if (t->remote == NULL) {
netsnmp_ssh_close(t);
netsnmp_transport_free(t);
return NULL;
}
memcpy(t->remote, (u_char *) & (addr->sin_addr.s_addr), 4);
t->remote[4] = (htons(addr->sin_port) & 0xff00) >> 8;
t->remote[5] = (htons(addr->sin_port) & 0x00ff) >> 0;
t->remote_length = 6;
/*
* This is a client-type session, so attempt to connect to the far
* end. We don't go non-blocking here because it's not obvious what
* you'd then do if you tried to do snmp_sends before the connection
* had completed. So this can block.
*/
rc = connect(t->sock, (struct sockaddr *)addr,
sizeof(struct sockaddr));
if (rc < 0) {
netsnmp_ssh_close(t);
netsnmp_transport_free(t);
return NULL;
}
/*
* Allow user to override the send and receive buffers. Default is
* to use os default. Don't worry too much about errors --
* just plough on regardless.
*/
netsnmp_sock_buffer_set(t->sock, SO_SNDBUF, local, 0);
netsnmp_sock_buffer_set(t->sock, SO_RCVBUF, local, 0);
/* open the SSH session and channel */
addr_pair->session = libssh2_session_init();
if (libssh2_session_startup(addr_pair->session, t->sock)) {
shutdown:
snmp_log(LOG_ERR, "Failed to establish an SSH session\n");
netsnmp_ssh_close(t);
netsnmp_transport_free(t);
return NULL;
}
/* At this point we havn't authenticated, The first thing to
do is check the hostkey's fingerprint against our known
hosts Your app may have it hard coded, may go to a file,
may present it to the user, that's your call
*/
fingerprint =
libssh2_hostkey_hash(addr_pair->session, LIBSSH2_HOSTKEY_HASH_MD5);
DEBUGMSGTL(("ssh", "Fingerprint: "));
for(i = 0; i < 16; i++) {
DEBUGMSG(("ssh", "%02x",
(unsigned char)fingerprint[i]));
}
DEBUGMSG(("ssh", "\n"));
/* check what authentication methods are available */
userauthlist =
libssh2_userauth_list(addr_pair->session,
username, strlen(username));
DEBUGMSG(("ssh", "Authentication methods: %s\n", userauthlist));
/* XXX: allow other types */
/* XXX: 4 seems magic to me... */
if (strstr(userauthlist, "publickey") != NULL) {
auth_pw |= 4;
}
/* XXX: hard coded paths and users */
if (auth_pw & 4) {
/* public key */
if (libssh2_userauth_publickey_fromfile(addr_pair->session,
username,
keyfilepub, keyfilepriv,
NULL)) {
snmp_log(LOG_ERR,"Authentication by public key failed!\n");
goto shutdown;
} else {
DEBUGMSG(("ssh",
"\tAuthentication by public key succeeded.\n"));
}
} else {
snmp_log(LOG_ERR,"Authentication by public key failed!\n");
goto shutdown;
}
/* we've now authenticated both sides; contining onward ... */
/* Request a channel */
if (!(addr_pair->channel =
libssh2_channel_open_session(addr_pair->session))) {
snmp_log(LOG_ERR, "Unable to open a session\n");
goto shutdown;
}
/* Request a terminal with 'vanilla' terminal emulation
* See /etc/termcap for more options
*/
/* XXX: needed? doubt it */
/* if (libssh2_channel_request_pty(addr_pair->channel, "vanilla")) { */
/* snmp_log(LOG_ERR, "Failed requesting pty\n"); */
/* goto shutdown; */
/* } */
if (libssh2_channel_subsystem(addr_pair->channel, "snmp")) {
snmp_log(LOG_ERR, "Failed to request the ssh 'snmp' subsystem\n");
goto shutdown;
}
}
DEBUGMSG(("ssh","Opened connection.\n"));
/*
* Message size is not limited by this transport (hence msgMaxSize
* is equal to the maximum legal size of an SNMP message).
*/
t->msgMaxSize = 0x7fffffff;
t->f_recv = netsnmp_ssh_recv;
t->f_send = netsnmp_ssh_send;
t->f_close = netsnmp_ssh_close;
t->f_accept = netsnmp_ssh_accept;
t->f_fmtaddr = netsnmp_ssh_fmtaddr;
return t;
}
netsnmp_transport *
netsnmp_ssh_create_tstring(const char *str, int local,
const char *default_target)
{
struct sockaddr_in addr;
if (netsnmp_sockaddr_in2(&addr, str, default_target)) {
return netsnmp_ssh_transport(&addr, local);
} else {
return NULL;
}
}
netsnmp_transport *
netsnmp_ssh_create_ostring(const u_char * o, size_t o_len, int local)
{
struct sockaddr_in addr;
if (o_len == 6) {
unsigned short porttmp = (o[4] << 8) + o[5];
addr.sin_family = AF_INET;
memcpy((u_char *) & (addr.sin_addr.s_addr), o, 4);
addr.sin_port = htons(porttmp);
return netsnmp_ssh_transport(&addr, local);
}
return NULL;
}
void
sshdomain_parse_socket(const char *token, char *cptr)
{
char *socket_perm, *socket_user, *socket_group;
int uid = -1;
int gid = -1;
int s_perm = -1;
char *st;
DEBUGMSGTL(("ssh/config", "parsing socket info: %s\n", cptr));
socket_perm = strtok_r(cptr, " \t", &st);
socket_user = strtok_r(NULL, " \t", &st);
socket_group = strtok_r(NULL, " \t", &st);
if (socket_perm) {
s_perm = strtol(socket_perm, NULL, 8);
netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_SSHDOMAIN_SOCK_PERM, s_perm);
DEBUGMSGTL(("ssh/config", "socket permissions: %o (%d)\n",
s_perm, s_perm));
}
/*
* Try to handle numeric UIDs or user names for the socket owner
*/
if (socket_user) {
uid = netsnmp_str_to_uid(socket_user);
if ( uid != 0 )
netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_SSHDOMAIN_SOCK_USER, uid);
DEBUGMSGTL(("ssh/config", "socket owner: %s (%d)\n",
socket_user, uid));
}
/*
* and similarly for the socket group ownership
*/
if (socket_group) {
gid = netsnmp_str_to_gid(socket_group);
if ( gid != 0 )
netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_SSHDOMAIN_SOCK_GROUP, gid);
DEBUGMSGTL(("ssh/config", "socket group: %s (%d)\n",
socket_group, gid));
}
}
void
netsnmp_ssh_ctor(void)
{
sshDomain.name = netsnmp_snmpSSHDomain;
sshDomain.name_length = netsnmp_snmpSSHDomain_len;
sshDomain.prefix = (const char **)calloc(2, sizeof(char *));
sshDomain.prefix[0] = "ssh";
sshDomain.f_create_from_tstring = NULL;
sshDomain.f_create_from_tstring_new = netsnmp_ssh_create_tstring;
sshDomain.f_create_from_ostring = netsnmp_ssh_create_ostring;
register_config_handler("snmp", "sshtosnmpsocketperms",
&sshdomain_parse_socket, NULL,
"socketperms [username [groupname]]");
netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "sshtosnmpsocket",
NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_LIB_SSHTOSNMP_SOCKET);
netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "sshusername",
NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_LIB_SSH_USERNAME);
netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "sshpublickey",
NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_LIB_SSH_PUBKEY);
netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "sshprivatekey",
NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_LIB_SSH_PRIVKEY);
DEBUGMSGTL(("ssh", "registering the ssh domain\n"));
netsnmp_tdomain_register(&sshDomain);
}
|
27ba4ff1f971d5c23400fa4d2d32315bb535070c | dc8cff737288b3515c4c4cd4f2554378eb771e87 | /5.custom/build/contact/rosidl_typesupport_fastrtps_c/contact/srv/dds_fastrtps_c/add_two_floats__request__type_support_c.cpp | 17517e35dcce54d1fe6f87349c86a1791cc2e324 | [] | no_license | songmilee/ros2_study | 2c3937e245c4876177e4ea757940317638abdf40 | 0cc6dcfbbc2a34c7a2eec5c94e8ab4b0f2fe9f9e | refs/heads/master | 2020-04-26T01:49:12.948462 | 2019-03-12T11:27:58 | 2019-03-12T11:27:58 | 173,215,863 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,592 | cpp | add_two_floats__request__type_support_c.cpp | // generated from rosidl_typesupport_fastrtps_c/resource/msg__type_support_c.cpp.em
// generated code does not contain a copyright notice
#include "contact/srv/add_two_floats__request__rosidl_typesupport_fastrtps_c.h"
#include <cassert>
#include <limits>
#include <string>
// Provides the rosidl_typesupport_fastrtps_c__identifier symbol declaration.
#include "rosidl_typesupport_fastrtps_c/identifier.h"
// Provides the definition of the message_type_support_callbacks_t struct.
#include "rosidl_typesupport_fastrtps_cpp/message_type_support.h"
#include "contact/msg/rosidl_typesupport_fastrtps_c__visibility_control.h"
#include "contact/srv/add_two_floats__request__struct.h"
#include "contact/srv/add_two_floats__request__functions.h"
#include "fastcdr/Cdr.h"
#ifndef _WIN32
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunused-parameter"
# ifdef __clang__
# pragma clang diagnostic ignored "-Wdeprecated-register"
# pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
# endif
#endif
#ifndef _WIN32
# pragma GCC diagnostic pop
#endif
// includes and forward declarations of message dependencies and their conversion functions
#if defined(__cplusplus)
extern "C"
{
#endif
// forward declare type support functions
using __ros_msg_type = contact__srv__AddTwoFloats_Request;
static bool __cdr_serialize(
const void * untyped_ros_message,
eprosima::fastcdr::Cdr & cdr)
{
if (!untyped_ros_message) {
fprintf(stderr, "ros message handle is null\n");
return false;
}
const __ros_msg_type * ros_message = static_cast<const __ros_msg_type *>(untyped_ros_message);
// Field name: a
{
cdr << ros_message->a;
}
// Field name: b
{
cdr << ros_message->b;
}
return true;
}
static bool __cdr_deserialize(
eprosima::fastcdr::Cdr & cdr,
void * untyped_ros_message)
{
if (!untyped_ros_message) {
fprintf(stderr, "ros message handle is null\n");
return false;
}
__ros_msg_type * ros_message = static_cast<__ros_msg_type *>(untyped_ros_message);
// Field name: a
{
cdr >> ros_message->a;
}
// Field name: b
{
cdr >> ros_message->b;
}
return true;
}
ROSIDL_TYPESUPPORT_FASTRTPS_C_PUBLIC_contact
size_t get_serialized_size_contact__srv__AddTwoFloats_Request(
const void * untyped_ros_message,
size_t current_alignment)
{
const __ros_msg_type * ros_message = static_cast<const __ros_msg_type *>(untyped_ros_message);
(void)ros_message;
size_t initial_alignment = current_alignment;
const size_t padding = 4;
(void)padding;
// field.name a
{
size_t item_size = sizeof(ros_message->a);
current_alignment += item_size +
eprosima::fastcdr::Cdr::alignment(current_alignment, item_size);
}
// field.name b
{
size_t item_size = sizeof(ros_message->b);
current_alignment += item_size +
eprosima::fastcdr::Cdr::alignment(current_alignment, item_size);
}
return current_alignment - initial_alignment;
}
static uint32_t __get_serialized_size(const void * untyped_ros_message)
{
return static_cast<uint32_t>(
get_serialized_size_contact__srv__AddTwoFloats_Request(
untyped_ros_message, 0));
}
ROSIDL_TYPESUPPORT_FASTRTPS_C_PUBLIC_contact
size_t max_serialized_size_contact__srv__AddTwoFloats_Request(
bool & full_bounded,
size_t current_alignment)
{
size_t initial_alignment = current_alignment;
const size_t padding = 4;
(void)padding;
(void)full_bounded;
// field.name a
{
size_t array_size = 1;
current_alignment += array_size * sizeof(uint64_t) +
eprosima::fastcdr::Cdr::alignment(current_alignment, sizeof(uint64_t));
}
// field.name b
{
size_t array_size = 1;
current_alignment += array_size * sizeof(uint64_t) +
eprosima::fastcdr::Cdr::alignment(current_alignment, sizeof(uint64_t));
}
return current_alignment - initial_alignment;
}
static size_t __max_serialized_size(bool & full_bounded)
{
return max_serialized_size_contact__srv__AddTwoFloats_Request(
full_bounded, 0);
}
static message_type_support_callbacks_t __callbacks = {
"contact",
"AddTwoFloats_Request",
__cdr_serialize,
__cdr_deserialize,
__get_serialized_size,
__max_serialized_size
};
static rosidl_message_type_support_t __type_support = {
rosidl_typesupport_fastrtps_c__identifier,
&__callbacks,
get_message_typesupport_handle_function,
};
const rosidl_message_type_support_t *
ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_fastrtps_c, contact, srv, AddTwoFloats_Request)() {
return &__type_support;
}
#if defined(__cplusplus)
}
#endif
|
f2c396d46981675588ffc00247a573607d9fe380 | aa59edc791efa1eea8bb477689e5ae227f7621b2 | /source/NanairoCore/Geometry/vector.cpp | a6f5e292003db8eab0be28fac2d70040330c5e46 | [
"MIT"
] | permissive | byzin/Nanairo | e5f30fb8fae8d65c45c768c8560524ac41f57d21 | 23fb6deeec73509c538a9c21009e12be63e8d0e4 | refs/heads/master | 2020-12-25T17:58:18.361872 | 2019-05-05T06:05:34 | 2019-05-05T06:05:34 | 18,831,971 | 32 | 6 | null | null | null | null | UTF-8 | C++ | false | false | 965 | cpp | vector.cpp | /*!
\file vector.cpp
\author Sho Ikeda
Copyright (c) 2015-2018 Sho Ikeda
This software is released under the MIT License.
http://opensource.org/licenses/mit-license.php
*/
#include "vector.hpp"
// Zisc
#include "zisc/arith_array.hpp"
#include "zisc/utility.hpp"
#include "zisc/vector.hpp"
// Nanairo
#include "NanairoCore/nanairo_core_config.hpp"
namespace nanairo {
//! Check if the vector contains the specified value
bool hasValue(const Vector3& vector, const Float value) noexcept
{
const auto& array = vector.data();
return array.hasValue(value);
}
//! Check if the vector is unit vector
bool isUnitVector(const Vector3& vector) noexcept
{
constexpr Float error = 1.0e-6;
return zisc::isInClosedBounds(vector.squareNorm(), 1.0 - error, 1.0 + error);
}
//! Check if the vector is zero vector
bool isZeroVector(const Vector3& vector) noexcept
{
const auto& array = vector.data();
return array.isAllZero();
}
} // namespace nanairo
|
815b823722d6066b1c1d8da53a7e73831f2235c9 | bcb569fb7eefce77ef4f31bca0cfa73029298ae0 | /Common/AllocServer/gameprocess/SetTableStatusProc.h | 64edf165dfa4d4e84ef72c2788133bce547d5248 | [] | no_license | xubingyue/GP | e3b3f69b3d412057933ca32e61a57005ab19df80 | 7b0e7b48c1389e39aafb83a7337723400f18ada5 | refs/heads/master | 2020-09-15T01:32:03.539712 | 2018-07-18T10:46:19 | 2018-07-18T10:46:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 440 | h | SetTableStatusProc.h | #ifndef _SetTableStatusProc_H
#define _SetTableStatusProc_H
#include "CDLSocketHandler.h"
#include "IProcess.h"
class SetTableStatusProc :public IProcess
{
public:
SetTableStatusProc();
virtual ~SetTableStatusProc();
virtual int doRequest(CDLSocketHandler* clientHandler, InputPacket* inputPacket, Context* pt ) ;
virtual int doResponse(CDLSocketHandler* clientHandler, InputPacket* inputPacket, Context* pt ) ;
};
#endif
|
e05151e9b4d50b878deb2153a70e78d7c1842d43 | 8c8243692d262395d07380cbf470da5918bd976b | /mcworker.cpp | 53d7bfe456bcd6f47285f55b465a19c55f7bcdda | [
"MIT"
] | permissive | ElsevierSoftwareX/SOFTX_2018_106 | 3369f428d98c425209453d409262a431190c1eec | ebfef9c9aaae4ddad1bda48d3822bc534157d37f | refs/heads/master | 2020-04-17T17:41:31.140505 | 2019-01-08T03:43:39 | 2019-01-08T03:43:39 | 166,792,609 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,088 | cpp | mcworker.cpp | #include "mcworker.h"
#include "includes.h"
#include <chrono>
#include <random>
static std::mt19937
rng(std::chrono::high_resolution_clock::now().time_since_epoch().count());
MCWorker::MCWorker(QMap<QString, double> a, QList<QString> g, double c,
unsigned long t, int th) {
map = a;
genes = g;
count = c;
trials = t;
thread = th;
counting = true;
}
void MCWorker::linearSearch() {
QMap<QString, unsigned long> gene_picks;
QMap<double, QString> gene_prob;
double cum_count = 0;
for (int i = 0; i < genes.length(); i++) {
gene_picks[genes[i]] = 0;
double p = map[genes[i]] / count;
cum_count = cum_count + p;
gene_prob[cum_count] = genes[i];
}
for (unsigned long j = 0; j < trials; j++) {
double random_number =
static_cast<double>(rng()) / (static_cast<double>(rng.max()));
QString picked_gene = gene_prob.upperBound(random_number).value();
gene_picks[picked_gene] = gene_picks[picked_gene] + 1;
}
emit linear_search_finished(thread, gene_picks);
}
void MCWorker::stopWork() { counting = false; }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.