{"id":25300145,"url":"https://github.com/deftio/absolute_this","last_synced_at":"2025-04-06T23:40:44.709Z","repository":{"id":9987027,"uuid":"12016770","full_name":"deftio/absolute_this","owner":"deftio","description":"Different bit twiddlings on abs() for C (or C++) -- more of a historical note than practical code","archived":false,"fork":false,"pushed_at":"2016-07-16T22:21:42.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-13T05:38:32.143Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deftio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-08-10T06:31:33.000Z","updated_at":"2022-04-28T16:42:29.000Z","dependencies_parsed_at":"2022-07-21T16:02:14.921Z","dependency_job_id":null,"html_url":"https://github.com/deftio/absolute_this","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deftio%2Fabsolute_this","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deftio%2Fabsolute_this/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deftio%2Fabsolute_this/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deftio%2Fabsolute_this/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deftio","download_url":"https://codeload.github.com/deftio/absolute_this/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247569129,"owners_count":20959758,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-13T05:38:33.328Z","updated_at":"2025-04-06T23:40:44.688Z","avatar_url":"https://github.com/deftio.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Absolute..This   A few thought  bitwiddling absolute values\n\t\n(c) 2000  M. A. Chatterjee,   \u003c deftio [at] deftio [dot] com \u003e  \n\nrelease notes:  \n* cleaned up comments 2012\n* changed to markdown 2016  \n\n\n\n## About this code and what it does\n\nActually this code does .. virtually nothing and is more of a historical\nexploration of different compiler/processor issues I was investigating in the\nmid 1990s.  Both embedded (e.g. ARM, mcore, 68xxx) and desktop (PowerPC, \n80x86) compilers were being target for work I was doing in speech and \nhandwriting recognition.  Many of the embedded platforms were running in\nthe low single digit to low 10s of MHz.  \n\nThese musings on bit shifting and absolute values come from the mid 1990s\nwhen processors could have pipeline stalls and I was experimenting with \nways to avoid cache/pipeline misses on branch predictors.\n\nThis started a subset line of thinking on measuring branch penalties \nvs statements.  Some processors then didn't have hardware absolute \nvalue (ABS) instructions so with a little fun the macros below were created.\nI make no statements that they were *useful* and I looked at these and \nother statement constructs to study\teffects of branch-miss, cache fill \nissues for a specific problem I was dealing with at the time which\nwhich I've since forgotten.  \n\nThose of you coming from a Java background, bear in mind the difference in \nJava between \u003e\u003e and \u003e\u003e\u003e as here in C \u003e\u003e means arithmetic shift (e.g. \nif there is a 1 in the high order bit then the register 1 fills\nnot zero-fills).\n\nI'm publishing this as a way to preserve some thought experiments rather than as a \ntrue open-source \"library\" of any kind.  Many times I've run accross some\nlittle brainbender of code someone wrote and thought \"hmmm cute\" and soe here\nis a small contribution to such thinking. \n\nCheers-\nMC \n\n\n## Building the Code\n\nSee C language code \"absolute_this.c\"\ncommand line compile via gcc or equivalent.\ne.g. in gcc\n```\n#build it\ngcc absolute_this.c -lm -o abs_this\n\n#run it\n./abs_this\n\nNote the code uses stdio.h so your platform will need to support printf like \nstatements.\n\n\n```\n\n\n## License\n\nCopyright (c) 2001-2016, M. A. Chatterjee \u003c deftio at deftio dot com \u003e\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n  list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n  this list of conditions and the following disclaimer in the documentation\n  and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeftio%2Fabsolute_this","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeftio%2Fabsolute_this","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeftio%2Fabsolute_this/lists"}