From patchwork Fri Apr 24 15:13:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 6270951 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 08D069F389 for ; Fri, 24 Apr 2015 15:14:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 550FC202F2 for ; Fri, 24 Apr 2015 15:14:05 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 53CF42018E for ; Fri, 24 Apr 2015 15:14:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 431C16E8D4; Fri, 24 Apr 2015 08:14:02 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-vn0-f52.google.com (mail-vn0-f52.google.com [209.85.216.52]) by gabe.freedesktop.org (Postfix) with ESMTP id B07466E8CB for ; Fri, 24 Apr 2015 08:14:00 -0700 (PDT) Received: by vnbf62 with SMTP id f62so4247219vnb.3 for ; Fri, 24 Apr 2015 08:14:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FXbKt6WCU7fcRenREaIEzMPx5M/flBA16zDw+nkBqgY=; b=r1WUsnJtnjrxNyQzhdOySWrfUceMuGxZlYATaexIJCFILAkLqQXgLpuAmRaxCQSU8S aFQgSVmAOiC5CirKfTkm9AZjR/HAFtnTh/H8iGsu1CDHBhrJlxprTzJi4zRBUParNHO3 mmDX993mzcQN3M8f0R6n75lZnqstjHM7TGUmSTk+nxQlP5yH+q5Hfq6SwC39GbD8vMvE PuREsXF/bSxm7TRiN2gR60kr9GQS2u40tGiT23U23J8wjSq5B/KaEL5gE5NSNizud2cw ty76kUsIamXGlRMEnD2jOyC/TwoWhW3a3hjBDP/h2hQuey/Kkora5TjN76Xo1yx+JiW1 puSQ== X-Received: by 10.52.35.2 with SMTP id d2mr9030148vdj.80.1429888440108; Fri, 24 Apr 2015 08:14:00 -0700 (PDT) Received: from localhost.localdomain (static-74-96-105-49.washdc.fios.verizon.net. [74.96.105.49]) by mx.google.com with ESMTPSA id ql13sm4420911vdb.2.2015.04.24.08.13.59 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Apr 2015 08:13:59 -0700 (PDT) From: Alex Deucher X-Google-Original-From: Alex Deucher To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/4] drm: add util_math.h Date: Fri, 24 Apr 2015 11:13:49 -0400 Message-Id: <1429888431-27459-2-git-send-email-alexander.deucher@amd.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1429888431-27459-1-git-send-email-alexander.deucher@amd.com> References: <1429888431-27459-1-git-send-email-alexander.deucher@amd.com> Cc: Alex Deucher X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Used by amdgpu, could be used by other components. Signed-off-by: Alex Deucher --- Makefile.sources | 3 ++- util_math.h | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 util_math.h diff --git a/Makefile.sources b/Makefile.sources index 862415c..e1d861b 100644 --- a/Makefile.sources +++ b/Makefile.sources @@ -9,7 +9,8 @@ LIBDRM_FILES := \ xf86atomic.h \ libdrm.h \ libdrm_lists.h \ - util_double_list.h + util_double_list.h \ + util_math.h LIBDRM_H_FILES := \ xf86drm.h \ diff --git a/util_math.h b/util_math.h new file mode 100644 index 0000000..b8de0f8 --- /dev/null +++ b/util_math.h @@ -0,0 +1,32 @@ +/* + * Copyright 2014 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * +*/ + +#ifndef _UTIL_MATH_H_ +#define _UTIL_MATH_H_ + +#define MIN2( A, B ) ( (A)<(B) ? (A) : (B) ) +#define MAX2( A, B ) ( (A)>(B) ? (A) : (B) ) + +#define ALIGN( value, alignment ) ( ((value) + (alignment) - 1) & ~((alignment) - 1) ) + +#endif /*_UTIL_MATH_H_*/